-
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.
feat: clear airbnb rules, use eslint:recommended instead (#9)
* feat: add use strict * WIP: use eslint:recommended * WIP: clear rules * feat: add jest eslint config * WIP: update
- Loading branch information
Showing
24 changed files
with
187 additions
and
1,837 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 |
---|---|---|
|
@@ -82,3 +82,10 @@ | |
} | ||
``` | ||
|
||
### jest 环境 | ||
`npm i -D @mjolnir/eslint-config eslint eslint-plugin-jest` | ||
|
||
#### 配置 | ||
```json | ||
|
||
``` |
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,6 +1,6 @@ | ||
'use strict'; | ||
|
||
// for babel env, base on es6 env | ||
module.exports = { | ||
extends: [ | ||
'./index', // 基于 es6 的配置 | ||
'./plugins/babel' | ||
].map(require.resolve) | ||
extends: ['./index', './plugins/babel'].map(require.resolve) | ||
}; |
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,15 +1,20 @@ | ||
'use strict'; | ||
|
||
// for es6 env | ||
module.exports = { | ||
root: true, // limit ESLint to a specific project | ||
env: { | ||
browser: true, | ||
es6: true // also enable ecmaVersion: 6 | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
ecmaVersion: 2018, // same as 9 | ||
sourceType: 'module', // ECMAScript module | ||
ecmaFeatures: { | ||
globalReturn: false, | ||
impliedStrict: true, | ||
jsx: true | ||
} | ||
}, | ||
env: { | ||
browser: true, | ||
es6: true | ||
}, | ||
extends: ['./rules', './plugins/import'].map(require.resolve) | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
// for jest env | ||
module.exports = { | ||
extends: ['./index', './plugins/jest'].map(require.resolve), | ||
rules: {} | ||
}; |
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,4 +1,8 @@ | ||
'use strict'; | ||
|
||
// for nodejs env, support es6+ syntax | ||
module.exports = { | ||
extends: ['./rules', './plugins/node'].map(require.resolve) | ||
root: true, // limit ESLint to a specific project | ||
extends: ['./rules', './plugins/node'].map(require.resolve), | ||
rules: {} | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
'use strict'; | ||
|
||
// eslint-plugin-babel has no recommend config | ||
module.exports = { | ||
parser: 'babel-eslint', | ||
|
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,3 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
plugins: ['import'], | ||
rules: { | ||
|
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
// plugin:jest/recommended: https://github.com/jest-community/eslint-plugin-jest/blob/master/README.md | ||
module.exports = { | ||
extends: ['plugin:jest/recommended'], | ||
rules: {} | ||
}; |
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,40 +1,10 @@ | ||
'use strict'; | ||
|
||
// plugin:node/recommended: https://github.com/mysticatea/eslint-plugin-node/blob/master/lib/index.js | ||
module.exports = { | ||
extends: ['plugin:node/recommended'], | ||
rules: { | ||
// enforce return after a callback | ||
'callback-return': 'off', | ||
|
||
// require all requires be top-level | ||
// https://eslint.org/docs/rules/global-require | ||
'global-require': 'error', | ||
|
||
// enforces error handling in callbacks (node environment) | ||
'handle-callback-err': 'off', | ||
|
||
// disallow use of the Buffer() constructor | ||
// https://eslint.org/docs/rules/no-buffer-constructor | ||
'no-buffer-constructor': 'error', | ||
|
||
// disallow mixing regular variable and require declarations | ||
'no-mixed-requires': ['off', false], | ||
|
||
// disallow use of new operator with the require function | ||
'no-new-require': 'error', | ||
|
||
// disallow string concatenation with __dirname and __filename | ||
// https://eslint.org/docs/rules/no-path-concat | ||
'no-path-concat': 'error', | ||
|
||
// disallow use of process.env | ||
'no-process-env': 'off', | ||
|
||
// disallow process.exit() | ||
'no-process-exit': 'off', | ||
|
||
// restrict usage of specified node modules | ||
'no-restricted-modules': 'off', | ||
|
||
// disallow use of synchronous methods (off by default) | ||
'no-sync': 'off' | ||
// commonjs or node env, should use global strict model | ||
strict: ['error', 'global'] | ||
} | ||
}; |
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,3 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
plugins: ['react-hooks'], | ||
rules: { | ||
|
Oops, something went wrong.