@shelf/eslint-config 2.18.0 → 2.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/base.js +4 -6
- package/{rules/extends-common.json → common/extends.json} +0 -0
- package/{rules → common}/overrides.js +0 -0
- package/frontend-typescript-vue.js +4 -5
- package/frontend-typescript.js +11 -11
- package/meteor.js +2 -2
- package/package.json +14 -14
- package/rules/padding-line-between-statements.json +30 -0
- package/rules/prefer-es6.json +14 -0
- package/rules/typescript.js +6 -0
- package/rules/you-dont-need-lodash.json +13 -0
- package/typescript.js +13 -15
- package/rules/padding-line-between-statements.js +0 -28
- package/rules/prefer-destructuring.js +0 -7
package/README.md
CHANGED
package/base.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const paddingLineBetweenStatements = require('./rules/padding-line-between-statements');
|
|
2
|
-
const
|
|
1
|
+
const paddingLineBetweenStatements = require('./rules/padding-line-between-statements.json');
|
|
2
|
+
const preferES6Features = require('./rules/prefer-es6.json');
|
|
3
3
|
const sortImports = require('./rules/sort-imports.json');
|
|
4
4
|
const importOrder = require('./rules/import-order.json');
|
|
5
5
|
const jestRules = require('./rules/jest.json');
|
|
@@ -21,14 +21,12 @@ module.exports = {
|
|
|
21
21
|
},
|
|
22
22
|
rules: {
|
|
23
23
|
'prettier/prettier': 'error',
|
|
24
|
-
|
|
24
|
+
...paddingLineBetweenStatements,
|
|
25
25
|
...jestRules,
|
|
26
|
-
...
|
|
26
|
+
...preferES6Features,
|
|
27
27
|
'no-empty': ['error', {allowEmptyCatch: true}],
|
|
28
28
|
...importOrder,
|
|
29
29
|
...sortImports,
|
|
30
|
-
'prefer-template': 'error',
|
|
31
|
-
'prefer-object-spread': 'error',
|
|
32
30
|
'comma-dangle': 'off',
|
|
33
31
|
camelcase: 'error',
|
|
34
32
|
eqeqeq: ['error', 'smart'],
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
const {allowRequireInConfigs, noExplicitReturnTypeInTests} = require('./
|
|
1
|
+
const {allowRequireInConfigs, noExplicitReturnTypeInTests} = require('./common/overrides');
|
|
2
2
|
const consistentTypeAssertions = require('./rules/consistent-type-assertions.json');
|
|
3
3
|
const consistentTypeImports = require('./rules/consistent-type-imports.json');
|
|
4
4
|
const vueConfig = require('./frontend-vue');
|
|
5
|
+
const typescriptRules = require('./rules/typescript');
|
|
5
6
|
|
|
6
7
|
module.exports = {
|
|
7
8
|
extends: [
|
|
@@ -16,13 +17,11 @@ module.exports = {
|
|
|
16
17
|
},
|
|
17
18
|
rules: {
|
|
18
19
|
...vueConfig.rules,
|
|
19
|
-
'@typescript-eslint/no-use-before-define': 0,
|
|
20
|
-
'@typescript-eslint/camelcase': 0,
|
|
21
|
-
'@typescript-eslint/explicit-member-accessibility': 0,
|
|
22
20
|
'jest/lowercase-name': 'off',
|
|
23
21
|
...consistentTypeAssertions,
|
|
24
|
-
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
25
22
|
...consistentTypeImports,
|
|
23
|
+
'@typescript-eslint/explicit-member-accessibility': 0,
|
|
24
|
+
...typescriptRules,
|
|
26
25
|
},
|
|
27
26
|
overrides: [allowRequireInConfigs, noExplicitReturnTypeInTests],
|
|
28
27
|
};
|
package/frontend-typescript.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
const commonExtends = require('./
|
|
1
|
+
const commonExtends = require('./common/extends.json');
|
|
2
2
|
const commonPlugins = require('./common/plugins');
|
|
3
3
|
const tsParser = require('./common/ts-parser');
|
|
4
|
-
const {allowRequireInConfigs, noExplicitReturnTypeInTests} = require('./
|
|
4
|
+
const {allowRequireInConfigs, noExplicitReturnTypeInTests} = require('./common/overrides');
|
|
5
5
|
const consistentTypeAssertions = require('./rules/consistent-type-assertions.json');
|
|
6
6
|
const consistentTypeImports = require('./rules/consistent-type-imports.json');
|
|
7
7
|
const frontendConfig = require('./frontend');
|
|
8
|
+
const youDontNeedLodashRules = require('./rules/you-dont-need-lodash.json');
|
|
9
|
+
const typescriptRules = require('./rules/typescript');
|
|
8
10
|
|
|
9
11
|
module.exports = {
|
|
10
|
-
extends: ['./frontend.js', ...commonExtends],
|
|
12
|
+
extends: ['./frontend.js', ...commonExtends, 'plugin:you-dont-need-lodash-underscore/compatible'],
|
|
11
13
|
globals: {
|
|
12
14
|
DD_LOGS: true,
|
|
13
15
|
},
|
|
@@ -15,17 +17,10 @@ module.exports = {
|
|
|
15
17
|
...tsParser,
|
|
16
18
|
rules: {
|
|
17
19
|
...frontendConfig.rules,
|
|
18
|
-
'@typescript-eslint/no-use-before-define': 0,
|
|
19
|
-
'@typescript-eslint/camelcase': 0,
|
|
20
|
-
// it fail to compile TS on react static class properties (displayName | defaultProps | etc..)
|
|
21
|
-
'@typescript-eslint/explicit-member-accessibility': 0,
|
|
22
20
|
// Often test name starts with component name which are always capitalized
|
|
23
21
|
'jest/lowercase-name': 'off',
|
|
24
|
-
// Don`t needed for typescript files
|
|
25
|
-
'@typescript-eslint/no-empty-function': 'off',
|
|
26
22
|
'react/prop-types': 'off',
|
|
27
23
|
'react/display-name': 'warn',
|
|
28
|
-
'@typescript-eslint/no-unused-vars': 'error',
|
|
29
24
|
...consistentTypeAssertions,
|
|
30
25
|
'testing-library/await-async-query': 'error',
|
|
31
26
|
'testing-library/no-await-sync-query': 'error',
|
|
@@ -36,8 +31,13 @@ module.exports = {
|
|
|
36
31
|
testIdPattern: '^(([a-z])+(-)*)+$',
|
|
37
32
|
},
|
|
38
33
|
],
|
|
39
|
-
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
40
34
|
...consistentTypeImports,
|
|
35
|
+
...youDontNeedLodashRules,
|
|
36
|
+
// it fail to compile TS on react static class properties (displayName | defaultProps | etc..)
|
|
37
|
+
'@typescript-eslint/explicit-member-accessibility': 0,
|
|
38
|
+
// Don`t need for typescript files
|
|
39
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
40
|
+
...typescriptRules,
|
|
41
41
|
},
|
|
42
42
|
overrides: [
|
|
43
43
|
allowRequireInConfigs,
|
package/meteor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const paddingLineBetweenStatements = require('./rules/padding-line-between-statements');
|
|
1
|
+
const paddingLineBetweenStatements = require('./rules/padding-line-between-statements.json');
|
|
2
2
|
const importOrder = require('./rules/import-order.json');
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
@@ -28,7 +28,7 @@ module.exports = {
|
|
|
28
28
|
rules: {
|
|
29
29
|
'prettier/prettier': 'error',
|
|
30
30
|
...importOrder,
|
|
31
|
-
|
|
31
|
+
...paddingLineBetweenStatements,
|
|
32
32
|
'comma-dangle': 'off',
|
|
33
33
|
camelcase: 'error',
|
|
34
34
|
eqeqeq: ['error', 'smart'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shelf/eslint-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.2",
|
|
4
4
|
"description": "ESLint Config for Shelf Projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "shelfio/eslint-config",
|
|
@@ -32,28 +32,29 @@
|
|
|
32
32
|
"eslintconfig"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@babel/eslint-parser": "7.
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
37
|
-
"@typescript-eslint/parser": "5.
|
|
35
|
+
"@babel/eslint-parser": "7.18.2",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "5.30.5",
|
|
37
|
+
"@typescript-eslint/parser": "5.30.5",
|
|
38
38
|
"eslint-config-next": "11.1.2",
|
|
39
39
|
"eslint-config-prettier": "8.5.0",
|
|
40
40
|
"eslint-plugin-babel": "5.3.1",
|
|
41
41
|
"eslint-plugin-import": "2.26.0",
|
|
42
|
-
"eslint-plugin-jest": "26.
|
|
42
|
+
"eslint-plugin-jest": "26.5.3",
|
|
43
43
|
"eslint-plugin-jest-formatting": "3.1.0",
|
|
44
44
|
"eslint-plugin-json-format": "2.0.1",
|
|
45
45
|
"eslint-plugin-jsx": "0.1.0",
|
|
46
|
-
"eslint-plugin-prettier": "4.
|
|
47
|
-
"eslint-plugin-react": "7.30.
|
|
48
|
-
"eslint-plugin-react-hooks": "4.
|
|
46
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
47
|
+
"eslint-plugin-react": "7.30.1",
|
|
48
|
+
"eslint-plugin-react-hooks": "4.6.0",
|
|
49
49
|
"eslint-plugin-sonarjs": "0.13.0",
|
|
50
|
-
"eslint-plugin-testing-library": "5.5.
|
|
51
|
-
"eslint-plugin-vue": "
|
|
50
|
+
"eslint-plugin-testing-library": "5.5.1",
|
|
51
|
+
"eslint-plugin-vue": "9.2.0",
|
|
52
|
+
"eslint-plugin-you-dont-need-lodash-underscore": "6.12.0"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"husky": "8.0.1",
|
|
55
|
-
"lint-staged": "
|
|
56
|
-
"prettier": "2.
|
|
56
|
+
"lint-staged": "13.0.3",
|
|
57
|
+
"prettier": "2.7.1"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"eslint": "7.x || 8.x",
|
|
@@ -61,8 +62,7 @@
|
|
|
61
62
|
},
|
|
62
63
|
"lint-staged": {
|
|
63
64
|
"*.{js,json,css,md,yml}": [
|
|
64
|
-
"prettier --write"
|
|
65
|
-
"git add"
|
|
65
|
+
"prettier --write"
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"padding-line-between-statements": [
|
|
3
|
+
"error",
|
|
4
|
+
{
|
|
5
|
+
"blankLine": "always",
|
|
6
|
+
"prev": "*",
|
|
7
|
+
"next": "return"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"blankLine": "always",
|
|
11
|
+
"prev": ["if", "const", "let", "var"],
|
|
12
|
+
"next": "if"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"blankLine": "always",
|
|
16
|
+
"prev": ["if"],
|
|
17
|
+
"next": ["const", "let", "var"]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"blankLine": "always",
|
|
21
|
+
"prev": ["import"],
|
|
22
|
+
"next": "*"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"blankLine": "never",
|
|
26
|
+
"prev": "import",
|
|
27
|
+
"next": "import"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"you-dont-need-lodash-underscore/uniq": "off",
|
|
3
|
+
"you-dont-need-lodash-underscore/last": "off",
|
|
4
|
+
"you-dont-need-lodash-underscore/omit": "off",
|
|
5
|
+
"you-dont-need-lodash-underscore/trim": "off",
|
|
6
|
+
"you-dont-need-lodash-underscore/is-string": "off",
|
|
7
|
+
"you-dont-need-lodash-underscore/is-function": "off",
|
|
8
|
+
"you-dont-need-lodash-underscore/get": "error",
|
|
9
|
+
"you-dont-need-lodash-underscore/every": "error",
|
|
10
|
+
"you-dont-need-lodash-underscore/map": "error",
|
|
11
|
+
"you-dont-need-lodash-underscore/filter": "error",
|
|
12
|
+
"you-dont-need-lodash-underscore/size": "error"
|
|
13
|
+
}
|
package/typescript.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
const commonExtends = require('./
|
|
1
|
+
const commonExtends = require('./common/extends.json');
|
|
2
2
|
const commonPlugins = require('./common/plugins');
|
|
3
3
|
const env = require('./common/env');
|
|
4
4
|
const importOrder = require('./rules/import-order.json');
|
|
5
5
|
const jestRules = require('./rules/jest.json');
|
|
6
|
-
const paddingLineBetweenStatements = require('./rules/padding-line-between-statements');
|
|
7
|
-
const
|
|
6
|
+
const paddingLineBetweenStatements = require('./rules/padding-line-between-statements.json');
|
|
7
|
+
const preferES6Features = require('./rules/prefer-es6.json');
|
|
8
8
|
const sortImports = require('./rules/sort-imports.json');
|
|
9
9
|
const tsParser = require('./common/ts-parser');
|
|
10
|
-
const {allowRequireInConfigs, noExplicitReturnTypeInTests} = require('./
|
|
10
|
+
const {allowRequireInConfigs, noExplicitReturnTypeInTests} = require('./common/overrides');
|
|
11
11
|
const consistentTypeAssertions = require('./rules/consistent-type-assertions.json');
|
|
12
12
|
const consistentTypeImports = require('./rules/consistent-type-imports.json');
|
|
13
|
+
const youDontNeedLodashRules = require('./rules/you-dont-need-lodash.json');
|
|
14
|
+
const typescriptRules = require('./rules/typescript');
|
|
13
15
|
|
|
14
16
|
module.exports = {
|
|
15
|
-
extends: commonExtends,
|
|
17
|
+
extends: [...commonExtends, 'plugin:you-dont-need-lodash-underscore/compatible'],
|
|
16
18
|
plugins: commonPlugins,
|
|
17
19
|
env,
|
|
18
20
|
...tsParser,
|
|
@@ -22,20 +24,13 @@ module.exports = {
|
|
|
22
24
|
curly: 'error',
|
|
23
25
|
'no-nested-ternary': 'error',
|
|
24
26
|
'prettier/prettier': 'error',
|
|
25
|
-
|
|
26
|
-
'padding-line-between-statements': paddingLineBetweenStatements,
|
|
27
|
+
...paddingLineBetweenStatements,
|
|
27
28
|
...jestRules,
|
|
28
|
-
...
|
|
29
|
-
'prefer-template': 'error',
|
|
30
|
-
'prefer-object-spread': 'error',
|
|
29
|
+
...preferES6Features,
|
|
31
30
|
...importOrder,
|
|
32
31
|
...sortImports,
|
|
33
|
-
'@typescript-eslint/no-unused-vars': 'error',
|
|
34
32
|
'comma-dangle': 'off',
|
|
35
|
-
'@typescript-eslint/ban-ts-comment': 'off',
|
|
36
33
|
...consistentTypeAssertions,
|
|
37
|
-
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
38
|
-
'@typescript-eslint/no-non-null-assertion': 'off', // we want to allow using the "!" operator
|
|
39
34
|
camelcase: [
|
|
40
35
|
'error',
|
|
41
36
|
{properties: 'never', ignoreGlobals: true, allow: ['hash_key', 'range_key']},
|
|
@@ -44,12 +39,15 @@ module.exports = {
|
|
|
44
39
|
'new-cap': 'error',
|
|
45
40
|
'no-extend-native': 'error',
|
|
46
41
|
'no-use-before-define': 'off',
|
|
47
|
-
'@typescript-eslint/no-use-before-define': 'off',
|
|
48
42
|
...consistentTypeImports,
|
|
49
43
|
'multiline-comment-style': ['error', 'separate-lines'],
|
|
50
44
|
'arrow-body-style': ['error', 'as-needed', {requireReturnForObjectLiteral: true}],
|
|
51
45
|
'no-unreachable': 'error',
|
|
52
46
|
'require-await': 'error',
|
|
47
|
+
...youDontNeedLodashRules,
|
|
48
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
49
|
+
'@typescript-eslint/no-non-null-assertion': 'off', // we want to allow using the "!" operator
|
|
50
|
+
...typescriptRules,
|
|
53
51
|
},
|
|
54
52
|
overrides: [allowRequireInConfigs, noExplicitReturnTypeInTests],
|
|
55
53
|
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
module.exports = [
|
|
2
|
-
'error',
|
|
3
|
-
{
|
|
4
|
-
blankLine: 'always',
|
|
5
|
-
prev: '*',
|
|
6
|
-
next: 'return',
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
blankLine: 'always',
|
|
10
|
-
prev: ['if', 'const', 'let', 'var'],
|
|
11
|
-
next: 'if',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
blankLine: 'always',
|
|
15
|
-
prev: ['if'],
|
|
16
|
-
next: ['const', 'let', 'var'],
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
blankLine: 'always',
|
|
20
|
-
prev: ['import'],
|
|
21
|
-
next: '*',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
blankLine: 'never',
|
|
25
|
-
prev: 'import',
|
|
26
|
-
next: 'import',
|
|
27
|
-
},
|
|
28
|
-
];
|