@viclafouch/eslint-config-viclafouch 4.16.0 → 4.17.1-beta.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.
@@ -1,191 +0,0 @@
1
- const { rules: baseBestPracticesRules } = require('./best-practices')
2
- const { rules: baseErrorsRules } = require('./errors')
3
- const { rules: baseVariablesRules } = require('./variables')
4
- const { rules: baseES6Rules } = require('./es6')
5
-
6
- /**
7
- * @type {import("eslint").Linter.Config}
8
- */
9
- module.exports = {
10
- extends: ['plugin:@typescript-eslint/recommended'],
11
- parser: '@typescript-eslint/parser',
12
- settings: {
13
- // Apply special parsing for TypeScript files
14
- 'import/parsers': {
15
- '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts']
16
- },
17
- // Append 'ts' extensions to @viclafouch/eslint 'import/resolver' setting
18
- // Original: ['.mjs', '.js', '.json']
19
- 'import/resolver': {
20
- node: {
21
- extensions: ['.mjs', '.js', '.json', '.ts', '.d.ts']
22
- }
23
- },
24
- // Append 'ts' extensions to @viclafouch/eslint 'import/extensions' setting
25
- // Original: ['.js', '.mjs', '.jsx']
26
- 'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.tsx', '.d.ts'],
27
- // Resolve type definition packages
28
- 'import/external-module-folders': ['node_modules', 'node_modules/@types']
29
- },
30
- rules: {
31
- // Replace @viclafouch/eslint 'default-param-last' rule with '@typescript-eslint' version
32
- // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/default-param-last.md
33
- 'default-param-last': 'off',
34
- '@typescript-eslint/default-param-last':
35
- baseBestPracticesRules['default-param-last'],
36
-
37
- // Replace @viclafouch/eslint 'dot-notation' rule with '@typescript-eslint' version
38
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
39
- 'dot-notation': 'off',
40
- '@typescript-eslint/dot-notation': baseBestPracticesRules['dot-notation'],
41
-
42
- // Replace @viclafouch/eslint 'no-empty-function' rule with '@typescript-eslint' version
43
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
44
- 'no-empty-function': 'off',
45
- '@typescript-eslint/no-empty-function':
46
- baseBestPracticesRules['no-empty-function'],
47
-
48
- // Replace @viclafouch/eslint 'no-extra-semi' rule with '@typescript-eslint' version
49
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
50
- 'no-extra-semi': 'off',
51
- '@typescript-eslint/no-extra-semi': baseErrorsRules['no-extra-semi'],
52
-
53
- // Replace @viclafouch/eslint 'no-redeclare' rule with '@typescript-eslint' version
54
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
55
- 'no-redeclare': 'off',
56
- '@typescript-eslint/no-redeclare': baseBestPracticesRules['no-redeclare'],
57
-
58
- // Replace @viclafouch/eslint 'no-shadow' rule with '@typescript-eslint' version
59
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
60
- 'no-shadow': 'off',
61
- '@typescript-eslint/no-shadow': baseVariablesRules['no-shadow'],
62
-
63
- // Replace @viclafouch/eslint 'no-unused-expressions' rule with '@typescript-eslint' version
64
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
65
- 'no-unused-expressions': 'off',
66
- '@typescript-eslint/no-unused-expressions':
67
- baseBestPracticesRules['no-unused-expressions'],
68
-
69
- // Replace @viclafouch/eslint 'no-unused-vars' rule with '@typescript-eslint' version
70
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
71
- 'no-unused-vars': 'off',
72
- '@typescript-eslint/no-unused-vars': baseVariablesRules['no-unused-vars'],
73
-
74
- // Replace @viclafouch/eslint 'no-use-before-define' rule with '@typescript-eslint' version
75
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
76
- 'no-use-before-define': 'off',
77
- '@typescript-eslint/no-use-before-define':
78
- baseVariablesRules['no-use-before-define'],
79
-
80
- // Replace @viclafouch/eslint 'no-useless-constructor' rule with '@typescript-eslint' version
81
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
82
- 'no-useless-constructor': 'off',
83
- '@typescript-eslint/no-useless-constructor':
84
- baseES6Rules['no-useless-constructor'],
85
-
86
- // Replace @viclafouch/eslint 'require-await' rule with '@typescript-eslint' version
87
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
88
- 'require-await': 'off',
89
- '@typescript-eslint/require-await': baseES6Rules['require-await'],
90
-
91
- // Replace @viclafouch/eslint 'no-return-await' rule with '@typescript-eslint' version
92
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
93
- 'no-return-await': 'off',
94
- '@typescript-eslint/return-await': [
95
- baseES6Rules['no-return-await'],
96
- 'in-try-catch'
97
- ],
98
-
99
- // Accept banning ts lines
100
- '@typescript-eslint/ban-ts-comment': 'off',
101
-
102
- // Naming convention
103
- '@typescript-eslint/naming-convention': [
104
- 'error',
105
- {
106
- selector: 'typeLike',
107
- format: ['PascalCase']
108
- }
109
- ],
110
-
111
- // Require consistently using T[] instead of Array<T>
112
- // https://typescript-eslint.io/rules/array-type
113
- '@typescript-eslint/array-type': 'error',
114
-
115
- // Forbid delete array, use splice for example
116
- // https://typescript-eslint.io/rules/no-array-delete/
117
- '@typescript-eslint/no-array-delete': 'error',
118
-
119
- // Don't do array.filter(callback)[0], use arrat.find instead
120
- // https://typescript-eslint.io/rules/prefer-find
121
- '@typescript-eslint/prefer-find': 'error',
122
-
123
- // Prefer to use String.startsWith and String.endsWith
124
- // https://typescript-eslint.io/rules/prefer-string-starts-ends-with
125
- '@typescript-eslint/prefer-string-starts-ends-with': 'error',
126
-
127
- // Prefer to use unknown instead of any for error in catch callback
128
- // https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
129
- // '@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
130
-
131
- // No more "as Record<any, any>" in Array.reduce initial value, use generics
132
- // https://typescript-eslint.io/rules/prefer-reduce-type-parameter
133
- '@typescript-eslint/prefer-reduce-type-parameter': 'error'
134
-
135
- // Prefer using nullish coalescing (??) over logical (||) when possible.
136
- // '@typescript-eslint/prefer-nullish-coalescing': 'error'
137
-
138
- // '@typescript-eslint/ban-types': [
139
- // 'error',
140
- // {
141
- // types: {
142
- // // Omit is not strict enought
143
- // Omit: {
144
- // // https://twitter.com/erikras/status/1673694889974833152
145
- // message:
146
- // 'Use StrictOmit instead by using reset.d.ts from @viclafouch/eslint-config-viclafouch/reset.d. See https://github.com/viclafouch/eslint-config-viclafouch#better-typing',
147
- // fixWith: 'StrictOmit'
148
- // }
149
- // }
150
- // }
151
- // ]
152
- },
153
- overrides: [
154
- {
155
- extends: ['plugin:@typescript-eslint/disable-type-checked'],
156
- files: ['./**/*.js', './**/*.cjs']
157
- },
158
- {
159
- files: ['*.ts?(x)'],
160
- rules: {
161
- // The following rules are enabled in @viclafouch/eslint config, but are already checked (more thoroughly) by the TypeScript compiler
162
- // Some of the rules also fail in TypeScript files, for example: https://github.com/typescript-eslint/typescript-eslint/issues/662#issuecomment-507081586
163
- // Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
164
- 'constructor-super': 'off',
165
- 'getter-return': 'off',
166
- 'no-const-assign': 'off',
167
- 'no-dupe-args': 'off',
168
- 'no-dupe-class-members': 'off',
169
- 'no-dupe-keys': 'off',
170
- 'no-func-assign': 'off',
171
- 'no-import-assign': 'off',
172
- 'no-new-symbol': 'off',
173
- 'no-obj-calls': 'off',
174
- 'no-redeclare': 'off',
175
- 'no-setter-return': 'off',
176
- 'no-this-before-super': 'off',
177
- // https://github.com/typescript-eslint/typescript-eslint/blob/1cf9243/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
178
- 'no-undef': 'off',
179
- 'no-unreachable': 'off',
180
- 'no-unsafe-negation': 'off',
181
- 'valid-typeof': 'off',
182
- // The following rules are enabled in @viclafouch/eslint config, but are recommended to be disabled within TypeScript projects
183
- // See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
184
- 'import/named': 'off',
185
- 'import/no-named-as-default-member': 'off',
186
- // Disable `import/no-unresolved`, see README.md for details
187
- 'import/no-unresolved': 'off'
188
- }
189
- }
190
- ]
191
- }
package/typescript.js DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * @type {import("eslint").Linter.Config}
3
- */
4
- module.exports = {
5
- extends: ['./rules/typescript.js'].map(require.resolve),
6
- rules: {},
7
- parserOptions: {
8
- project: './tsconfig.json'
9
- }
10
- }