@shelf/eslint-config 5.1.0 → 5.2.0
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/base.js +1 -2
- package/frontend-typescript.js +7 -7
- package/package.json +25 -23
- package/rules/consistent-type-assertions.js +7 -7
- package/rules/consistent-type-imports.js +2 -2
- package/rules/import-order.js +11 -11
- package/rules/jest.js +31 -31
- package/rules/padding-line-between-statements.js +20 -20
- package/rules/prefer-es6.js +9 -9
- package/rules/restricted-packages-import.js +30 -32
- package/rules/sort-imports.js +9 -9
- package/rules/you-dont-need-lodash.js +13 -13
- package/typescript.js +4 -4
package/base.js
CHANGED
|
@@ -2,15 +2,14 @@ import jestFormatting from 'eslint-plugin-jest-formatting';
|
|
|
2
2
|
import prettier from 'eslint-plugin-prettier';
|
|
3
3
|
import jestPlugin from 'eslint-plugin-jest';
|
|
4
4
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
5
|
+
import stylisticJs from '@stylistic/eslint-plugin-js';
|
|
5
6
|
import env from './common/env.js';
|
|
6
7
|
import paddingLineBetweenStatements from './rules/padding-line-between-statements.js';
|
|
7
8
|
import jestRules from './rules/jest.js';
|
|
8
9
|
import preferEs6 from './rules/prefer-es6.js';
|
|
9
10
|
import importOrder from './rules/import-order.js';
|
|
10
11
|
import sortImports from './rules/sort-imports.js';
|
|
11
|
-
import stylisticJs from '@stylistic/eslint-plugin-js';
|
|
12
12
|
import comments from './rules/comments.js';
|
|
13
|
-
import overrides from './common/overrides.js';
|
|
14
13
|
|
|
15
14
|
export default [
|
|
16
15
|
{
|
package/frontend-typescript.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import {fileURLToPath} from 'node:url';
|
|
1
3
|
import node from 'eslint-plugin-n';
|
|
2
4
|
import testingLibrary from 'eslint-plugin-testing-library';
|
|
3
5
|
import {fixupConfigRules, fixupPluginRules} from '@eslint/compat';
|
|
4
6
|
import tsParser from '@typescript-eslint/parser';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import {fileURLToPath} from 'node:url';
|
|
7
7
|
import js from '@eslint/js';
|
|
8
8
|
import {FlatCompat} from '@eslint/eslintrc';
|
|
9
9
|
import tsEslint from 'typescript-eslint';
|
|
10
|
-
import overrides from './common/overrides.js';
|
|
11
|
-
import youDontNeedLodash from './rules/you-dont-need-lodash.js';
|
|
12
|
-
import typescriptRules from './rules/typescript.js';
|
|
13
|
-
import consistentTypeImports from './rules/consistent-type-imports.js';
|
|
14
10
|
import sonarjs from 'eslint-plugin-sonarjs';
|
|
15
11
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
16
|
-
import baseConfig from './base.js';
|
|
17
12
|
import react from 'eslint-plugin-react';
|
|
18
13
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
19
14
|
import _import from 'eslint-plugin-import';
|
|
20
15
|
import globals from 'globals';
|
|
16
|
+
import overrides from './common/overrides.js';
|
|
17
|
+
import youDontNeedLodash from './rules/you-dont-need-lodash.js';
|
|
18
|
+
import typescriptRules from './rules/typescript.js';
|
|
19
|
+
import consistentTypeImports from './rules/consistent-type-imports.js';
|
|
20
|
+
import baseConfig from './base.js';
|
|
21
21
|
import env from './common/env.js';
|
|
22
22
|
import restrictedPackagesImport from './rules/restricted-packages-import.js';
|
|
23
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shelf/eslint-config",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "ESLint Config for Shelf Projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "shelfio/eslint-config",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"test": "echo ok",
|
|
17
|
-
"prepare": "husky"
|
|
17
|
+
"prepare": "husky",
|
|
18
|
+
"lint": "eslint . --fix"
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
21
|
"common",
|
|
@@ -29,38 +30,39 @@
|
|
|
29
30
|
"eslintconfig"
|
|
30
31
|
],
|
|
31
32
|
"resolutions": {
|
|
32
|
-
"strip-ansi": "
|
|
33
|
+
"strip-ansi": "7.1.0"
|
|
33
34
|
},
|
|
34
35
|
"type": "module",
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@eslint/compat": "1.
|
|
37
|
-
"@eslint/eslintrc": "3.
|
|
38
|
-
"@eslint/js": "9.
|
|
39
|
-
"@stylistic/eslint-plugin-js": "
|
|
40
|
-
"@types/eslint__js": "
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
42
|
-
"@typescript-eslint/parser": "8.
|
|
43
|
-
"eslint-config-next": "15.
|
|
44
|
-
"eslint-config-prettier": "10.1.
|
|
37
|
+
"@eslint/compat": "1.3.0",
|
|
38
|
+
"@eslint/eslintrc": "3.3.1",
|
|
39
|
+
"@eslint/js": "9.29.0",
|
|
40
|
+
"@stylistic/eslint-plugin-js": "4.4.1",
|
|
41
|
+
"@types/eslint__js": "9.14.0",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "8.34.0",
|
|
43
|
+
"@typescript-eslint/parser": "8.34.0",
|
|
44
|
+
"eslint-config-next": "15.3.3",
|
|
45
|
+
"eslint-config-prettier": "10.1.5",
|
|
45
46
|
"eslint-plugin-babel": "5.3.1",
|
|
46
47
|
"eslint-plugin-import": "2.31.0",
|
|
47
|
-
"eslint-plugin-jest": "28.
|
|
48
|
+
"eslint-plugin-jest": "28.14.0",
|
|
48
49
|
"eslint-plugin-jest-formatting": "3.1.0",
|
|
49
50
|
"eslint-plugin-jsx": "0.1.0",
|
|
50
|
-
"eslint-plugin-n": "17.
|
|
51
|
-
"eslint-plugin-prettier": "5.
|
|
52
|
-
"eslint-plugin-react": "7.37.
|
|
51
|
+
"eslint-plugin-n": "17.20.0",
|
|
52
|
+
"eslint-plugin-prettier": "5.4.1",
|
|
53
|
+
"eslint-plugin-react": "7.37.5",
|
|
53
54
|
"eslint-plugin-react-hooks": "5.2.0",
|
|
54
55
|
"eslint-plugin-shelf-no-need-lodash-methods": "2.0.8",
|
|
55
56
|
"eslint-plugin-sonarjs": "3.0.2",
|
|
56
|
-
"eslint-plugin-testing-library": "7.
|
|
57
|
+
"eslint-plugin-testing-library": "7.5.3",
|
|
57
58
|
"eslint-plugin-you-dont-need-lodash-underscore": "6.14.0",
|
|
58
|
-
"globals": "
|
|
59
|
-
"typescript-eslint": "8.
|
|
59
|
+
"globals": "16.2.0",
|
|
60
|
+
"typescript-eslint": "8.34.0"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
63
|
+
"eslint": "9.29.0",
|
|
62
64
|
"husky": "9.1.7",
|
|
63
|
-
"lint-staged": "
|
|
65
|
+
"lint-staged": "16.1.2",
|
|
64
66
|
"prettier": "3.5.3"
|
|
65
67
|
},
|
|
66
68
|
"peerDependencies": {
|
|
@@ -68,9 +70,9 @@
|
|
|
68
70
|
"prettier": "3.x"
|
|
69
71
|
},
|
|
70
72
|
"lint-staged": {
|
|
71
|
-
"*.{
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
"*.{html,md,yml}": "prettier --write",
|
|
74
|
+
"*.{ts,js,json}": "eslint --fix",
|
|
75
|
+
".circleci/config.yml": ".husky/validate-circleci-config.sh"
|
|
74
76
|
},
|
|
75
77
|
"publishConfig": {
|
|
76
78
|
"access": "public"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
'@typescript-eslint/consistent-type-assertions': [
|
|
3
|
+
'error',
|
|
4
4
|
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
]
|
|
9
|
-
}
|
|
5
|
+
assertionStyle: 'as',
|
|
6
|
+
objectLiteralTypeAssertions: 'never',
|
|
7
|
+
},
|
|
8
|
+
],
|
|
9
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
'@typescript-eslint/consistent-type-imports': ['error', {prefer: 'type-imports'}],
|
|
3
|
+
};
|
package/rules/import-order.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
'import/order': [
|
|
3
|
+
'error',
|
|
4
4
|
{
|
|
5
|
-
|
|
5
|
+
pathGroups: [
|
|
6
6
|
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
7
|
+
pattern: '*@shelf/types**',
|
|
8
|
+
group: 'internal',
|
|
9
|
+
position: 'before',
|
|
10
|
+
},
|
|
11
11
|
],
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
}
|
|
12
|
+
groups: ['builtin', 'external', 'internal', 'type', 'parent', 'sibling', 'index'],
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
};
|
package/rules/jest.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
'jest/consistent-test-it': [
|
|
3
|
+
'error',
|
|
4
4
|
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
5
|
+
fn: 'it',
|
|
6
|
+
withinDescribe: 'it',
|
|
7
|
+
},
|
|
8
8
|
],
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
'jest/expect-expect': [
|
|
10
|
+
'warn',
|
|
11
11
|
{
|
|
12
|
-
|
|
13
|
-
}
|
|
12
|
+
assertFunctionNames: ['expect'],
|
|
13
|
+
},
|
|
14
14
|
],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
15
|
+
'jest/prefer-lowercase-title': 'error',
|
|
16
|
+
'jest/no-commented-out-tests': 'error',
|
|
17
|
+
'jest/no-duplicate-hooks': 'error',
|
|
18
|
+
'jest/no-export': 'error',
|
|
19
|
+
'jest/no-large-snapshots': 'warn',
|
|
20
|
+
'jest/no-conditional-in-test': 'warn',
|
|
21
|
+
'jest/no-mocks-import': 'warn',
|
|
22
|
+
'jest/no-standalone-expect': 'warn',
|
|
23
|
+
'jest/no-done-callback': 'error',
|
|
24
|
+
'jest/no-test-return-statement': 'warn',
|
|
25
|
+
'jest/no-truthy-falsy': 'off',
|
|
26
|
+
'jest/no-try-expect': 'off',
|
|
27
|
+
'jest/prefer-called-with': 'warn',
|
|
28
|
+
'jest/prefer-inline-snapshots': 'off',
|
|
29
|
+
'jest/prefer-spy-on': 'warn',
|
|
30
|
+
'jest/prefer-strict-equal': 'off',
|
|
31
|
+
'jest/prefer-todo': 'warn',
|
|
32
|
+
'jest/require-to-throw-message': 'warn',
|
|
33
|
+
'jest/valid-title': 'error',
|
|
34
|
+
'jest/no-conditional-expect': 'off',
|
|
35
|
+
'jest/prefer-to-be': 'off',
|
|
36
|
+
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
'@stylistic/js/padding-line-between-statements': [
|
|
3
|
+
'error',
|
|
4
4
|
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
blankLine: 'always',
|
|
6
|
+
prev: '*',
|
|
7
|
+
next: 'return',
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
blankLine: 'always',
|
|
11
|
+
prev: ['if', 'const', 'let', 'var'],
|
|
12
|
+
next: 'if',
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
blankLine: 'always',
|
|
16
|
+
prev: ['if'],
|
|
17
|
+
next: ['const', 'let', 'var'],
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
blankLine: 'always',
|
|
21
|
+
prev: ['import'],
|
|
22
|
+
next: '*',
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|
|
25
|
+
blankLine: 'never',
|
|
26
|
+
prev: 'import',
|
|
27
|
+
next: 'import',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
package/rules/prefer-es6.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
'prefer-destructuring': [
|
|
3
|
+
'error',
|
|
4
4
|
{
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
array: false,
|
|
6
|
+
object: true,
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
|
-
|
|
10
|
-
}
|
|
9
|
+
enforceForRenamedProperties: false,
|
|
10
|
+
},
|
|
11
11
|
],
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
12
|
+
'prefer-template': 'error',
|
|
13
|
+
'prefer-object-spread': 'error',
|
|
14
|
+
};
|
|
@@ -1,50 +1,48 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
'no-restricted-imports': [
|
|
3
|
+
'error',
|
|
4
4
|
{
|
|
5
|
-
|
|
6
|
-
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
],
|
|
11
|
-
"message": "Use @shelf/datetime instead"
|
|
12
|
-
}
|
|
5
|
+
patterns: [
|
|
6
|
+
{
|
|
7
|
+
group: ['date-fns', '@shelf/dates'],
|
|
8
|
+
message: 'Use @shelf/datetime instead',
|
|
9
|
+
},
|
|
13
10
|
],
|
|
14
|
-
|
|
11
|
+
paths: [
|
|
15
12
|
{
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
name: 'normalize-space-x',
|
|
14
|
+
message: 'Please use @shelf/fast-normalize-spaces instead!',
|
|
18
15
|
},
|
|
19
16
|
{
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
name: 'javascript-natural-sort',
|
|
18
|
+
message: 'Please use @shelf/fast-natural-order-by instead!',
|
|
22
19
|
},
|
|
23
20
|
{
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
name: 'natural-orderby',
|
|
22
|
+
message: 'Please use @shelf/fast-natural-order-by instead!',
|
|
26
23
|
},
|
|
27
24
|
{
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
name: 'uslug',
|
|
26
|
+
message: 'Please use @shelf/fast-uslug instead!',
|
|
30
27
|
},
|
|
31
28
|
{
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
name: 'fast-chunk-string',
|
|
30
|
+
message: 'Please use @shelf/fast-chunk-string instead!',
|
|
34
31
|
},
|
|
35
32
|
{
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
name: 'toc',
|
|
34
|
+
message: 'Please use @shelf/table-of-contents instead!',
|
|
38
35
|
},
|
|
39
36
|
{
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
name: 'uuid',
|
|
38
|
+
message: "Please use import {randomUUID} from 'crypto' instead!",
|
|
42
39
|
},
|
|
43
40
|
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
name: 'react-outside-click-handler',
|
|
42
|
+
message:
|
|
43
|
+
'Please use [@shelf/react-outside-click](https://www.npmjs.com/package/@shelf/react-outside-click)',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
package/rules/sort-imports.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
'sort-imports': [
|
|
3
|
+
'error',
|
|
4
4
|
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
5
|
+
ignoreCase: false,
|
|
6
|
+
ignoreDeclarationSort: true,
|
|
7
|
+
ignoreMemberSort: false,
|
|
8
|
+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
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
|
+
'you-dont-need-lodash-underscore/includes': 'error',
|
|
14
|
+
};
|
package/typescript.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import {fileURLToPath} from 'node:url';
|
|
1
3
|
import jestFormatting from 'eslint-plugin-jest-formatting';
|
|
2
4
|
import prettier from 'eslint-plugin-prettier';
|
|
3
5
|
import _import from 'eslint-plugin-import';
|
|
4
6
|
import node from 'eslint-plugin-n';
|
|
5
7
|
import {fixupPluginRules} from '@eslint/compat';
|
|
6
8
|
import tsParser from '@typescript-eslint/parser';
|
|
7
|
-
import path from 'node:path';
|
|
8
|
-
import {fileURLToPath} from 'node:url';
|
|
9
9
|
import js from '@eslint/js';
|
|
10
10
|
import {FlatCompat} from '@eslint/eslintrc';
|
|
11
11
|
import tsEslint from 'typescript-eslint';
|
|
12
12
|
import jestPlugin from 'eslint-plugin-jest';
|
|
13
13
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
14
14
|
import shelfNoLodash from 'eslint-plugin-shelf-no-need-lodash-methods';
|
|
15
|
+
import stylisticJs from '@stylistic/eslint-plugin-js';
|
|
15
16
|
import env from './common/env.js';
|
|
16
17
|
import jestRules from './rules/jest.js';
|
|
17
18
|
import paddingLineBetweenStatements from './rules/padding-line-between-statements.js';
|
|
@@ -24,7 +25,6 @@ import youDontNeedLodash from './rules/you-dont-need-lodash.js';
|
|
|
24
25
|
import typescriptRules from './rules/typescript.js';
|
|
25
26
|
import restrictedPackagesImport from './rules/restricted-packages-import.js';
|
|
26
27
|
import overrides from './common/overrides.js';
|
|
27
|
-
import stylisticJs from '@stylistic/eslint-plugin-js';
|
|
28
28
|
|
|
29
29
|
const __filename = fileURLToPath(import.meta.url);
|
|
30
30
|
const __dirname = path.dirname(__filename);
|
|
@@ -119,7 +119,7 @@ export default [
|
|
|
119
119
|
'warn',
|
|
120
120
|
{
|
|
121
121
|
min: 1,
|
|
122
|
-
max:
|
|
122
|
+
max: 22,
|
|
123
123
|
},
|
|
124
124
|
],
|
|
125
125
|
'no-unreachable': 'error',
|