@viclafouch/eslint-config-viclafouch 4.17.0 → 4.17.1-beta.1

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,199 +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
- // Disallow duplicate constituents of union or intersection types.
136
- // https://typescript-eslint.io/rules/no-duplicate-type-constituents
137
- '@typescript-eslint/no-duplicate-type-constituents': 'error',
138
-
139
- // Disallow using code marked as @deprecated.
140
- // https://typescript-eslint.io/rules/no-deprecated
141
- '@typescript-eslint/no-deprecated': 'error'
142
-
143
- // Prefer using nullish coalescing (??) over logical (||) when possible.
144
- // '@typescript-eslint/prefer-nullish-coalescing': 'error'
145
-
146
- // '@typescript-eslint/ban-types': [
147
- // 'error',
148
- // {
149
- // types: {
150
- // // Omit is not strict enought
151
- // Omit: {
152
- // // https://twitter.com/erikras/status/1673694889974833152
153
- // message:
154
- // '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',
155
- // fixWith: 'StrictOmit'
156
- // }
157
- // }
158
- // }
159
- // ]
160
- },
161
- overrides: [
162
- {
163
- extends: ['plugin:@typescript-eslint/disable-type-checked'],
164
- files: ['./**/*.js', './**/*.cjs']
165
- },
166
- {
167
- files: ['*.ts?(x)'],
168
- rules: {
169
- // The following rules are enabled in @viclafouch/eslint config, but are already checked (more thoroughly) by the TypeScript compiler
170
- // Some of the rules also fail in TypeScript files, for example: https://github.com/typescript-eslint/typescript-eslint/issues/662#issuecomment-507081586
171
- // Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
172
- 'constructor-super': 'off',
173
- 'getter-return': 'off',
174
- 'no-const-assign': 'off',
175
- 'no-dupe-args': 'off',
176
- 'no-dupe-class-members': 'off',
177
- 'no-dupe-keys': 'off',
178
- 'no-func-assign': 'off',
179
- 'no-import-assign': 'off',
180
- 'no-new-symbol': 'off',
181
- 'no-obj-calls': 'off',
182
- 'no-redeclare': 'off',
183
- 'no-setter-return': 'off',
184
- 'no-this-before-super': 'off',
185
- // 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
186
- 'no-undef': 'off',
187
- 'no-unreachable': 'off',
188
- 'no-unsafe-negation': 'off',
189
- 'valid-typeof': 'off',
190
- // The following rules are enabled in @viclafouch/eslint config, but are recommended to be disabled within TypeScript projects
191
- // See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
192
- 'import/named': 'off',
193
- 'import/no-named-as-default-member': 'off',
194
- // Disable `import/no-unresolved`, see README.md for details
195
- 'import/no-unresolved': 'off'
196
- }
197
- }
198
- ]
199
- }
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
- }