Skip to content

Commit

Permalink
feat(style): add prettier configs
Browse files Browse the repository at this point in the history
feat(esm): add separate config for esm
  • Loading branch information
TobiTenno committed Mar 29, 2022
1 parent 4b1966f commit b8611e3
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 20 deletions.
47 changes: 28 additions & 19 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ module.exports = {
},
},
],
strict: [
'error',
'safe',
],
strict: ['error', 'safe'],
'linebreak-style': ['error', 'unix'],
'no-await-in-loop': 'off',
'func-names': 0,
Expand All @@ -46,30 +43,42 @@ module.exports = {
'max-classes-per-file': 'off',
'consistent-return': 'off',
'class-methods-use-this': 'off',
'max-len': ['error', {
code: 120,
tabWidth: 2,
comments: 120,
ignoreTemplateLiterals: true,
ignoreStrings: true,
}],
'max-len': [
'error',
{
code: 120,
tabWidth: 2,
comments: 120,
ignoreTemplateLiterals: true,
ignoreStrings: true,
},
],
'import/no-unresolved': 0,
'no-null/no-null': 2,
quotes: [
2,
'single',
{
avoidEscape: true,
allowTemplateLiterals: true,
},
],
'prettier/prettier': [
'error',
{},
{
usePrettierrc: true,
},
],
},
extends: [
'prettier',
'airbnb-base',
],
extends: ['airbnb-base', 'plugin:prettier/recommended'],
plugins: ['no-null'],
parser: '@babel/eslint-parser',
parserOptions: {
sourceType: 'script',
ecmaVersion: 6,
babelOptions: {
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
],
plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-private-methods'],
},
},
};
73 changes: 73 additions & 0 deletions esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
'use strict';

module.exports = {
globals: {},
rules: {
'valid-jsdoc': [
'error',
{
requireReturn: false,
requireReturnDescription: false,
preferType: {
String: 'string',
Number: 'number',
Boolean: 'boolean',
Function: 'function',
object: 'Object',
date: 'Date',
error: 'Error',
},
prefer: {
return: 'returns',
},
},
],
strict: ['error', 'safe'],
'linebreak-style': ['error', 'unix'],
'no-await-in-loop': 'off',
'func-names': 0,
'global-require': 0,
'no-param-reassign': 'off',
'no-continue': 'off',
'lines-between-class-members': 'off',
'no-fallthrough': 'off',
'no-case-declarations': 'off',
'default-case': 'off',
'max-classes-per-file': 'off',
'consistent-return': 'off',
'class-methods-use-this': 'off',
'max-len': [
'error',
{
code: 120,
tabWidth: 2,
comments: 120,
ignoreTemplateLiterals: true,
ignoreStrings: true,
},
],
'import/no-unresolved': 0,
'no-null/no-null': 2,
'import/extensions': 0,
'prettier/prettier': [
'error',
{},
{
usePrettierrc: true,
},
],
},
extends: ['airbnb-base', 'plugin:prettier/recommended'],
plugins: ['no-null'],
parser: '@babel/eslint-parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 6,
ecmaFeatures: {
modules: true,
},
babelOptions: {
plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-private-methods'],
},
},
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
},
"homepage": "https://github.com/wfcd/eslint-config#readme",
"exports": {
".": "./index.js"
".": "./index.js",
"./esm": "./esm.js",
"./prettier": "./prettier.config.js"
},
"peerDependencies": {
"@babel/core": "^7",
Expand Down
12 changes: 12 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

module.exports = {
trailingComma: 'es5',
tabWidth: 2,
semi: true,
singleQuote: true,
quoteProps: 'as-needed',
bracketSpacing: true,
arrowParens: 'always',
printWidth: 120,
};

0 comments on commit b8611e3

Please sign in to comment.