@voiceflow/eslint-config 7.9.1 → 7.10.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/package.json +18 -13
- package/src/base.js +3 -0
- package/src/index.js +2 -1
- package/src/node.js +14 -0
- package/src/presets/common.js +15 -0
- package/src/presets/import.js +1 -0
- package/src/presets/mdx.js +24 -0
- package/src/presets/typescript.js +69 -58
- package/src/presets/utility.js +38 -23
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voiceflow/eslint-config",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.10.0",
|
|
4
|
+
"exports": {
|
|
5
|
+
".": "./src/index.js",
|
|
6
|
+
"./node": "./src/node.js"
|
|
7
|
+
},
|
|
4
8
|
"main": "src/index.js",
|
|
5
9
|
"files": [
|
|
6
10
|
"src"
|
|
@@ -14,25 +18,26 @@
|
|
|
14
18
|
"test:dependencies": "yarn g:depcruise --ignore-known"
|
|
15
19
|
},
|
|
16
20
|
"dependencies": {
|
|
17
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
18
|
-
"@typescript-eslint/parser": "8.
|
|
21
|
+
"@typescript-eslint/eslint-plugin": "8.21.0",
|
|
22
|
+
"@typescript-eslint/parser": "8.21.0",
|
|
19
23
|
"eslint-config-airbnb-base": "15.0.0",
|
|
20
|
-
"eslint-config-prettier": "
|
|
24
|
+
"eslint-config-prettier": "10.0.1",
|
|
21
25
|
"eslint-formatter-junit": "8.40.0",
|
|
22
26
|
"eslint-formatter-stylish": "8.40.0",
|
|
23
|
-
"eslint-import-resolver-typescript": "3.
|
|
27
|
+
"eslint-import-resolver-typescript": "3.7.0",
|
|
24
28
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
25
29
|
"eslint-plugin-import": "2.31.0",
|
|
26
|
-
"eslint-plugin-jsdoc": "50.
|
|
27
|
-
"eslint-plugin-
|
|
30
|
+
"eslint-plugin-jsdoc": "50.6.2",
|
|
31
|
+
"eslint-plugin-mdx": "3.1.5",
|
|
32
|
+
"eslint-plugin-no-secrets": "2.1.1",
|
|
28
33
|
"eslint-plugin-prefer-arrow": "1.2.3",
|
|
29
|
-
"eslint-plugin-prettier": "5.2.
|
|
30
|
-
"eslint-plugin-promise": "7.1
|
|
34
|
+
"eslint-plugin-prettier": "5.2.3",
|
|
35
|
+
"eslint-plugin-promise": "7.2.1",
|
|
31
36
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
32
|
-
"eslint-plugin-sonarjs": "
|
|
33
|
-
"eslint-plugin-unicorn": "56.0.
|
|
37
|
+
"eslint-plugin-sonarjs": "3.0.1",
|
|
38
|
+
"eslint-plugin-unicorn": "56.0.1",
|
|
34
39
|
"eslint-plugin-you-dont-need-lodash-underscore": "6.14.0",
|
|
35
|
-
"globals": "15.
|
|
40
|
+
"globals": "15.14.0"
|
|
36
41
|
},
|
|
37
42
|
"devDependencies": {
|
|
38
43
|
"@voiceflow/dependency-cruiser-config": "1.8.7"
|
|
@@ -43,5 +48,5 @@
|
|
|
43
48
|
"volta": {
|
|
44
49
|
"extends": "../../package.json"
|
|
45
50
|
},
|
|
46
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "626b9812cdd9210d1bae4db8a3aad0eef852b7d7"
|
|
47
52
|
}
|
package/src/base.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const base = require('./base');
|
|
2
2
|
const typescript = require('./presets/typescript');
|
|
3
|
+
const mdx = require('./presets/mdx');
|
|
3
4
|
const nest = require('./presets/nest');
|
|
4
5
|
const utility = require('./presets/utility');
|
|
5
6
|
|
|
6
7
|
/** @type {import('eslint').Linter.Config[]} */
|
|
7
|
-
module.exports = [...base, typescript, ...nest, utility];
|
|
8
|
+
module.exports = [...base, ...typescript, ...mdx, ...nest, ...utility];
|
package/src/node.js
ADDED
package/src/presets/common.js
CHANGED
|
@@ -63,6 +63,17 @@ module.exports = [
|
|
|
63
63
|
'quote-props': ['error', 'as-needed'],
|
|
64
64
|
'prefer-arrow-callback': 'error',
|
|
65
65
|
'lines-between-class-members': 'error',
|
|
66
|
+
'no-restricted-imports': [
|
|
67
|
+
'error',
|
|
68
|
+
{
|
|
69
|
+
paths: [
|
|
70
|
+
{
|
|
71
|
+
name: '@/main',
|
|
72
|
+
message: "Importing '@/main' directly is not allowed due to cyclic dependencies.",
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
66
77
|
|
|
67
78
|
'prefer-arrow/prefer-arrow-functions': [
|
|
68
79
|
'error',
|
|
@@ -99,17 +110,21 @@ module.exports = [
|
|
|
99
110
|
camelcase: 'off',
|
|
100
111
|
'no-underscore-dangle': 'off',
|
|
101
112
|
'no-restricted-syntax': 'off',
|
|
113
|
+
'sonarjs/new-cap': 'off',
|
|
102
114
|
'sonarjs/no-unreachable': 'off',
|
|
103
115
|
'sonarjs/no-commented-code': 'off',
|
|
104
116
|
'sonarjs/no-hardcoded-credentials': 'off', // covered by no-secrets
|
|
117
|
+
'sonarjs/no-hardcoded-passwords': 'off', // covered by no-secrets
|
|
105
118
|
'sonarjs/use-type-alias': 'off', // too rigid to be useful
|
|
106
119
|
'sonarjs/no-unstable-nested-components': 'off', // too rigid to be useful
|
|
107
120
|
'sonarjs/prefer-function-type': 'off', // too rigid to be useful
|
|
108
121
|
'sonarjs/assertions-in-tests': 'off', // too rigid to be useful
|
|
109
122
|
'sonarjs/no-empty-test-file': 'off', // too rigid to be useful
|
|
123
|
+
'sonarjs/no-unused-vars': 'off', // too rigid to be useful
|
|
110
124
|
'sonarjs/no-nested-conditional': 'off', // covered by no-nested-ternary
|
|
111
125
|
'sonarjs/sonar-no-unused-vars': 'off', // covered by other rules
|
|
112
126
|
'sonarjs/no-empty-function': 'off', // covered by other rules
|
|
127
|
+
'sonarjs/no-control-regex': 'off', // covered by other rules
|
|
113
128
|
'sonarjs/constructor-for-side-effects': 'off', // covered by other rules
|
|
114
129
|
'sonarjs/sonar-max-params': 'off', // covered by other rules
|
|
115
130
|
},
|
package/src/presets/import.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const mdx = require('eslint-plugin-mdx');
|
|
2
|
+
|
|
3
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
4
|
+
module.exports = [
|
|
5
|
+
{
|
|
6
|
+
...mdx.flat,
|
|
7
|
+
files: ['**/*.mdx'],
|
|
8
|
+
processor: mdx.createRemarkProcessor({ lintCodeBlocks: true }),
|
|
9
|
+
rules: {
|
|
10
|
+
...mdx.flat.rules,
|
|
11
|
+
'no-secrets/no-secrets': 'off',
|
|
12
|
+
'react/jsx-no-undef': 'off',
|
|
13
|
+
'no-unused-vars': 'off',
|
|
14
|
+
'max-len': 'off',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
...mdx.flatCodeBlocks,
|
|
19
|
+
rules: {
|
|
20
|
+
...mdx.flatCodeBlocks.rules,
|
|
21
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
];
|
|
@@ -1,75 +1,86 @@
|
|
|
1
1
|
const typescript = require('@typescript-eslint/eslint-plugin');
|
|
2
2
|
const typescriptParser = require('@typescript-eslint/parser');
|
|
3
3
|
|
|
4
|
-
/** @type {import('eslint').Linter.Config} */
|
|
5
|
-
module.exports =
|
|
6
|
-
|
|
4
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
5
|
+
module.exports = [
|
|
6
|
+
{
|
|
7
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'],
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
plugins: {
|
|
10
|
+
'@typescript-eslint': typescript,
|
|
11
|
+
},
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
languageOptions: {
|
|
14
|
+
parser: typescriptParser,
|
|
15
|
+
},
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
rules: {
|
|
18
|
+
...typescript.configs.recommended.rules,
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
20
|
+
// error
|
|
21
|
+
'@typescript-eslint/no-empty-interface': [
|
|
22
|
+
'error',
|
|
23
|
+
{
|
|
24
|
+
// Allow `interface T extends U {}`
|
|
25
|
+
allowSingleExtends: true,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
'@typescript-eslint/no-empty-object-type': [
|
|
29
|
+
'error',
|
|
30
|
+
{
|
|
31
|
+
// Allow `interface T extends U {}`
|
|
32
|
+
allowInterfaces: 'with-single-extends',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
36
|
+
'@typescript-eslint/no-unused-vars': [
|
|
37
|
+
'error',
|
|
38
|
+
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
39
|
+
],
|
|
40
|
+
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
// off
|
|
43
|
+
'no-undef': 'off',
|
|
44
|
+
'no-shadow': 'off',
|
|
45
|
+
'no-redeclare': 'off',
|
|
46
|
+
'no-unused-vars': 'off',
|
|
47
|
+
'no-use-before-define': 'off',
|
|
48
|
+
'no-dupe-class-members': 'off',
|
|
49
|
+
'no-useless-constructor': 'off',
|
|
50
|
+
'no-empty-function': ['error', { allow: ['constructors'] }],
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
53
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
54
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
'import/export': 'off',
|
|
57
|
-
'import/named': 'off',
|
|
56
|
+
'sonarjs/no-redeclare': 'off',
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
'import/no-unresolved': 'off',
|
|
59
|
+
'import/export': 'off',
|
|
60
|
+
'import/named': 'off',
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
62
|
+
// incompatible with eslint 9
|
|
63
|
+
'import/no-named-as-default-member': 'off',
|
|
66
64
|
},
|
|
67
|
-
'import/resolver': {
|
|
68
|
-
typescript: {
|
|
69
|
-
alwaysTryTypes: true,
|
|
70
65
|
|
|
71
|
-
|
|
66
|
+
settings: {
|
|
67
|
+
'import/parsers': {
|
|
68
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
69
|
+
},
|
|
70
|
+
'import/resolver': {
|
|
71
|
+
typescript: {
|
|
72
|
+
alwaysTryTypes: true,
|
|
73
|
+
|
|
74
|
+
project: 'tsconfig.json',
|
|
75
|
+
},
|
|
72
76
|
},
|
|
73
77
|
},
|
|
74
78
|
},
|
|
75
|
-
|
|
79
|
+
{
|
|
80
|
+
files: ['**/*.tsx'],
|
|
81
|
+
|
|
82
|
+
rules: {
|
|
83
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
];
|
package/src/presets/utility.js
CHANGED
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
const EXTENSIONS = `{${['js', 'jsx', 'cjs', 'mjs', 'ts', 'tsx', 'cts', 'mts'].join(',')}}`;
|
|
2
2
|
|
|
3
|
-
/** @type {import('eslint').Linter.Config} */
|
|
4
|
-
module.exports =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
4
|
+
module.exports = [
|
|
5
|
+
{
|
|
6
|
+
files: [
|
|
7
|
+
`**/*.test.${EXTENSIONS}`,
|
|
8
|
+
`**/*.it.${EXTENSIONS}`,
|
|
9
|
+
`**/*.spec.${EXTENSIONS}`,
|
|
10
|
+
`**/*.story.${EXTENSIONS}`,
|
|
11
|
+
`**/*.config.${EXTENSIONS}`,
|
|
12
|
+
'config/**',
|
|
13
|
+
'cypress/**',
|
|
14
|
+
'.storybook/**',
|
|
15
|
+
'test/**',
|
|
16
|
+
'tests/**',
|
|
17
|
+
'**/__*__/**',
|
|
18
|
+
],
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
rules: {
|
|
21
|
+
// Strings may end up being duplicated in test files
|
|
22
|
+
'sonarjs/no-duplicate-string': 'off',
|
|
23
|
+
'promise/catch-or-return': 'off',
|
|
24
|
+
'promise/always-return': 'off',
|
|
25
|
+
'promise/no-nesting': 'off',
|
|
26
|
+
'sonarjs/no-clear-text-protocols': 'off',
|
|
27
|
+
'sonarjs/no-nested-functions': 'off',
|
|
28
|
+
'sonarjs/pseudo-random': 'off',
|
|
29
|
+
'sonarjs/no-useless-react-setstate': 'off',
|
|
30
|
+
'max-classes-per-file': 'off',
|
|
31
|
+
'no-restricted-imports': 'off',
|
|
32
|
+
'no-empty-function': 'off',
|
|
33
|
+
},
|
|
26
34
|
},
|
|
27
|
-
|
|
35
|
+
{
|
|
36
|
+
files: [`**/*.config.${EXTENSIONS}`],
|
|
37
|
+
|
|
38
|
+
rules: {
|
|
39
|
+
'no-restricted-exports': 'off',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|