generated from Exabyte-io/template-definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Exabyte-io/feat/SOF-6397-1
SOF-6397-1: add prettier plugin and config for eslint
- Loading branch information
Showing
5 changed files
with
135 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,32 +7,45 @@ | |
|
||
1. Install config with eslint and eslint plugins | ||
|
||
``` | ||
npm install --save-dev \ | ||
@exabyte-io/eslint-config \ | ||
@babel/[email protected] \ | ||
@babel/[email protected] \ | ||
@babel/[email protected] \ | ||
@babel/[email protected] \ | ||
@babel/register@^7.16.0 \ | ||
@babel/[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
eslint-import-resolver-exports@^1.0.0-beta.2 \ | ||
eslint-import-resolver-meteor@^0.4.0 \ | ||
eslint-import-resolver-node@^0.3.6 \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] | ||
``` | ||
``` | ||
npm install --save-dev \ | ||
@exabyte-io/eslint-config \ | ||
@babel/[email protected] \ | ||
@babel/[email protected] \ | ||
@babel/[email protected] \ | ||
@babel/[email protected] \ | ||
@babel/register@^7.16.0 \ | ||
@babel/[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
eslint-import-resolver-exports@^1.0.0-beta.2 \ | ||
eslint-import-resolver-meteor@^0.4.0 \ | ||
eslint-import-resolver-node@^0.3.6 \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] | ||
``` | ||
|
||
|
||
2. Create own `.eslintrc.json`: | ||
|
||
``` | ||
{ | ||
"extends": "@exabyte-io/eslint-config" | ||
} | ||
``` | ||
```JSON | ||
{ | ||
"extends": "@exabyte-io/eslint-config" | ||
} | ||
``` | ||
|
||
3. Add prettier config `.prettierrc`: | ||
|
||
```JSON | ||
{ | ||
"singleQuote": false, | ||
"printWidth": 100, | ||
"trailingComma": "all", | ||
"tabWidth": 4 | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,59 @@ | ||
module.exports = { | ||
extends: ['airbnb', 'eslint:recommended'], | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
paths: ['src'], | ||
}, | ||
exports: {}, | ||
extends: ["airbnb", "prettier", "eslint:recommended"], | ||
settings: { | ||
"import/resolver": { | ||
node: { | ||
paths: ["src"], | ||
}, | ||
exports: {}, | ||
}, | ||
}, | ||
}, | ||
parser: '@babel/eslint-parser', | ||
env: { | ||
browser: true, | ||
node: true, | ||
mocha: true, | ||
}, | ||
plugins: ['simple-import-sort', 'jsdoc'], | ||
rules: { | ||
'array-element-newline': ['error', 'consistent'], | ||
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], | ||
'object-curly-spacing': 'error', | ||
'no-trailing-spaces': 'error', | ||
'one-var': ['error', { uninitialized: 'always', initialized: 'never' }], | ||
'brace-style': ['error', '1tbs', { allowSingleLine: true }], | ||
'prefer-template': 'off', | ||
camelcase: 'off', | ||
'no-console': 'off', | ||
'no-unused-expressions': 'warn', | ||
'no-confusing-arrow': 'off', | ||
'no-underscore-dangle': 'off', | ||
'no-return-assign': 'off', | ||
'consistent-return': 'off', | ||
'arrow-body-style': 'off', | ||
'import/prefer-default-export': 'off', | ||
'import/no-named-as-default-member': 'warn', | ||
'no-param-reassign': ['warn', { props: false }], | ||
'max-classes-per-file': 'warn', | ||
'simple-import-sort/imports': [ | ||
'warn', | ||
{ | ||
groups: [ | ||
// Side effect imports. | ||
['^\\u0000'], | ||
// Packages. | ||
// Things that start with a letter (or digit or underscore), or `@` followed by a letter. | ||
['^@?\\w'], | ||
// Absolute imports | ||
[ | ||
'^(components|configs|constants|containers|domain|enhancers|hocs|libs|pages|reducers|services|store|modules|dictionaries)(/.*|$)', | ||
], | ||
// Relative imports. | ||
// Anything that starts with a dot. | ||
['^\\.'], | ||
parser: "@babel/eslint-parser", | ||
env: { | ||
browser: true, | ||
node: true, | ||
mocha: true, | ||
}, | ||
plugins: ["simple-import-sort", "prettier", "jsdoc"], | ||
rules: { | ||
"prettier/prettier": "error", | ||
"array-element-newline": ["error", "consistent"], | ||
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }], | ||
"object-curly-spacing": "error", | ||
"no-trailing-spaces": "error", | ||
"one-var": ["error", { uninitialized: "always", initialized: "never" }], | ||
"brace-style": ["error", "1tbs", { allowSingleLine: true }], | ||
"prefer-template": "off", | ||
camelcase: "off", | ||
"no-console": "off", | ||
"no-unused-expressions": "warn", | ||
"no-confusing-arrow": "off", | ||
"no-underscore-dangle": "off", | ||
"no-return-assign": "off", | ||
"consistent-return": "off", | ||
"arrow-body-style": "off", | ||
"import/prefer-default-export": "off", | ||
"import/no-named-as-default-member": "warn", | ||
"no-param-reassign": ["warn", { props: false }], | ||
"max-classes-per-file": "warn", | ||
"simple-import-sort/imports": [ | ||
"warn", | ||
{ | ||
groups: [ | ||
// Side effect imports. | ||
["^\\u0000"], | ||
// Packages. | ||
// Things that start with a letter (or digit or underscore), or `@` followed by a letter. | ||
["^@?\\w"], | ||
// Absolute imports | ||
[ | ||
"^(components|configs|constants|containers|domain|enhancers|hocs|libs|pages|reducers|services|store|modules|dictionaries)(/.*|$)", | ||
], | ||
// Relative imports. | ||
// Anything that starts with a dot. | ||
["^\\."], | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
indent: [ | ||
'error', | ||
4, | ||
{ | ||
SwitchCase: 1, | ||
ignoredNodes: ['TemplateLiteral'], | ||
}, | ||
], | ||
'comma-dangle': ['error', 'always-multiline'], | ||
quotes: [1, 'double', 'avoid-escape'], | ||
'jsx-quotes': ['error', 'prefer-double'], | ||
'max-len': [ | ||
'error', | ||
100, | ||
4, | ||
{ | ||
ignoreUrls: true, | ||
ignoreComments: true, | ||
ignoreTemplateLiterals: true, | ||
ignoreStrings: true, | ||
}, | ||
], | ||
}, | ||
}, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters