eslint-config-tamia 9.4.4 → 9.6.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/Readme.md +1 -0
- package/package.json +8 -7
- package/rules/misc.mjs +3 -0
- package/rules/typescript.mjs +60 -13
- package/rules/unicorn.mjs +4 -1
package/Readme.md
CHANGED
|
@@ -12,6 +12,7 @@ All presets include the following ESLint plugins:
|
|
|
12
12
|
- [eslint-plugin-de-morgan](https://github.com/azat-io/eslint-plugin-de-morgan)
|
|
13
13
|
- [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
14
14
|
- [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest)
|
|
15
|
+
- [eslint-plugin-washing-code](https://github.com/sapegin/eslint-plugin-washing-code/)
|
|
15
16
|
|
|
16
17
|
## Usage
|
|
17
18
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-tamia",
|
|
3
3
|
"description": "Tâmia ESLint config",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.6.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
7
7
|
},
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"homepage": "https://github.com/sapegin/eslint-config-tamia",
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/eslint__js": "^8.42.3",
|
|
48
|
-
"@types/react": "^19.
|
|
49
|
-
"eslint": ">=9.
|
|
50
|
-
"react": "^19.
|
|
48
|
+
"@types/react": "^19.2.2",
|
|
49
|
+
"eslint": ">=9.38",
|
|
50
|
+
"react": "^19.2.0",
|
|
51
51
|
"vitest": "^3.2.4"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
@@ -55,12 +55,13 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
|
|
58
|
-
"@eslint/js": "9.
|
|
59
|
-
"@vitest/eslint-plugin": "1.3.
|
|
58
|
+
"@eslint/js": "9.38.0",
|
|
59
|
+
"@vitest/eslint-plugin": "1.3.23",
|
|
60
60
|
"eslint-plugin-de-morgan": "2.0.0",
|
|
61
61
|
"eslint-plugin-react": "7.37.5",
|
|
62
62
|
"eslint-plugin-unicorn": "61.0.2",
|
|
63
|
+
"eslint-plugin-washing-code": "1.0.0",
|
|
63
64
|
"globals": "16.4.0",
|
|
64
|
-
"typescript-eslint": "8.
|
|
65
|
+
"typescript-eslint": "8.46.1"
|
|
65
66
|
}
|
|
66
67
|
}
|
package/rules/misc.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import comments from '@eslint-community/eslint-plugin-eslint-comments/configs';
|
|
2
2
|
import deMorgan from 'eslint-plugin-de-morgan';
|
|
3
|
+
import washingCode from 'eslint-plugin-washing-code';
|
|
3
4
|
|
|
4
5
|
export default [
|
|
5
6
|
// Disallows useless ESLint disable comments, etc.
|
|
@@ -7,6 +8,8 @@ export default [
|
|
|
7
8
|
// Enforces logical consistency by transforming negated boolean expressions
|
|
8
9
|
// according to De Morgan’s laws
|
|
9
10
|
deMorgan.configs.recommended,
|
|
11
|
+
// Rules inspired by Washing your code book
|
|
12
|
+
washingCode.configs.recommended,
|
|
10
13
|
{
|
|
11
14
|
rules: {},
|
|
12
15
|
},
|
package/rules/typescript.mjs
CHANGED
|
@@ -4,14 +4,16 @@ import tseslint from 'typescript-eslint';
|
|
|
4
4
|
// produces false positives, for examples, in CommonJS files
|
|
5
5
|
|
|
6
6
|
function findConfig(name) {
|
|
7
|
-
return tseslint.configs.
|
|
7
|
+
return tseslint.configs.recommendedTypeChecked.find((x) => x.name === name);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const baseConfig = findConfig('typescript-eslint/base');
|
|
11
11
|
const eslintRecommendedConfig = findConfig(
|
|
12
12
|
'typescript-eslint/eslint-recommended'
|
|
13
13
|
);
|
|
14
|
-
const
|
|
14
|
+
const recommendedTypeCheckedConfig = findConfig(
|
|
15
|
+
'typescript-eslint/recommended-type-checked'
|
|
16
|
+
);
|
|
15
17
|
|
|
16
18
|
/** @type { import("eslint").Linter.FlatConfig[] } */
|
|
17
19
|
export default [
|
|
@@ -19,22 +21,25 @@ export default [
|
|
|
19
21
|
// Only apply to files with TypeScript
|
|
20
22
|
files: ['**/*.{ts,tsx,mts,mtsx,astro}'],
|
|
21
23
|
|
|
22
|
-
//
|
|
23
|
-
languageOptions:
|
|
24
|
+
// Apply default TypeScript options and enable type checking
|
|
25
|
+
languageOptions: {
|
|
26
|
+
...baseConfig.languageOptions,
|
|
27
|
+
parserOptions: {
|
|
28
|
+
projectService: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
24
31
|
plugins: baseConfig.plugins,
|
|
25
32
|
|
|
26
33
|
rules: {
|
|
27
34
|
// Recommended rules
|
|
28
35
|
...eslintRecommendedConfig.rules,
|
|
29
|
-
...
|
|
36
|
+
...recommendedTypeCheckedConfig.rules,
|
|
30
37
|
|
|
31
38
|
// Disable generic rules that conflict with TypeScript
|
|
32
39
|
// Most of them are disabled in typescript-eslint/eslint-recommended
|
|
33
40
|
// config, but here are a few more
|
|
34
41
|
camelcase: 'off',
|
|
35
|
-
'
|
|
36
|
-
'no-unused-vars': 'off',
|
|
37
|
-
'no-unused-expressions': 'off',
|
|
42
|
+
'dot-notation': 'off',
|
|
38
43
|
'no-use-before-define': 'off',
|
|
39
44
|
'no-shadow': 'off',
|
|
40
45
|
// Conflicts with TypeScript check for unreachable code
|
|
@@ -46,8 +51,22 @@ export default [
|
|
|
46
51
|
|
|
47
52
|
// Require that function overload signatures be consecutive
|
|
48
53
|
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
49
|
-
//
|
|
54
|
+
// Consistently use T[] instead of Array<T> for arrays
|
|
50
55
|
'@typescript-eslint/array-type': 'error',
|
|
56
|
+
// Enforce specifying generic type arguments on constructor name of a
|
|
57
|
+
// constructor call (new Map<string, number>())
|
|
58
|
+
'@typescript-eslint/consistent-generic-constructors': 'error',
|
|
59
|
+
// Require the Record type
|
|
60
|
+
'@typescript-eslint/consistent-indexed-object-style': 'error',
|
|
61
|
+
// Enforce consistent usage of type assertions (`value as Type` instead of
|
|
62
|
+
// `<Type>value`)
|
|
63
|
+
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
64
|
+
// Enforce type definitions to consistently use `interface`
|
|
65
|
+
'@typescript-eslint/consistent-type-definitions': 'error',
|
|
66
|
+
// Enforce consistent usage of type exports
|
|
67
|
+
'@typescript-eslint/consistent-type-exports': 'error',
|
|
68
|
+
// Enforce dot notation whenever possible
|
|
69
|
+
'@typescript-eslint/dot-notation': 'error',
|
|
51
70
|
// Enforce naming conventions for everything across a codebase
|
|
52
71
|
'@typescript-eslint/naming-convention': [
|
|
53
72
|
'error',
|
|
@@ -81,18 +100,46 @@ export default [
|
|
|
81
100
|
],
|
|
82
101
|
// Require explicit accessibility modifiers on class properties and methods
|
|
83
102
|
'@typescript-eslint/explicit-member-accessibility': 'error',
|
|
84
|
-
// Enforce consistent usage of type assertions
|
|
85
|
-
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
86
103
|
// Disallow explicit type declarations for variables or parameters
|
|
87
104
|
// initialized to a number, string, or boolean
|
|
88
105
|
'@typescript-eslint/no-inferrable-types': 'error',
|
|
106
|
+
// Disallow void type outside of generic or return types
|
|
107
|
+
'@typescript-eslint/no-invalid-void-type': 'error',
|
|
108
|
+
// Disallow the void operator except when used to discard a value
|
|
109
|
+
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
|
110
|
+
// Disallow using the spread operator when it might cause unexpected behavior
|
|
111
|
+
'@typescript-eslint/no-misused-spread': 'error',
|
|
112
|
+
// Disallow enums from having both number and string members
|
|
113
|
+
'@typescript-eslint/no-mixed-enums': 'error',
|
|
89
114
|
// Disallow non-null assertions using the ! postfix operator
|
|
90
115
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
91
|
-
// Disallow unused expressions
|
|
92
|
-
'@typescript-eslint/no-unused-expressions': 'error',
|
|
93
116
|
// Disallow variable declarations from shadowing variables declared
|
|
94
117
|
// in the outer scope
|
|
95
118
|
'@typescript-eslint/no-shadow': 'error',
|
|
119
|
+
// Disallow conditionals where the type is always truthy or always falsy
|
|
120
|
+
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
121
|
+
// Disallow unnecessary assignment of constructor property parameter
|
|
122
|
+
'@typescript-eslint/no-unnecessary-parameter-property-assignment':
|
|
123
|
+
'error',
|
|
124
|
+
// Disallow unnecessary template expressions
|
|
125
|
+
'@typescript-eslint/no-unnecessary-template-expression': 'error',
|
|
126
|
+
// Disallow type arguments that are equal to the default
|
|
127
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
128
|
+
// Disallow conversion idioms when they do not change the type or value of
|
|
129
|
+
// the expression
|
|
130
|
+
'@typescript-eslint/no-unnecessary-type-conversion': 'error',
|
|
131
|
+
// Prefer optional chaining (`x.?y`) instead of chained logical ANDs
|
|
132
|
+
// (`x && x.y`)
|
|
133
|
+
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
134
|
+
// Enforce using the nullish coalescing operator instead of logical
|
|
135
|
+
// assignments or chaining
|
|
136
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
137
|
+
// Require function parameters to be typed as readonly to prevent accidental
|
|
138
|
+
// mutation of inputs
|
|
139
|
+
'@typescript-eslint/prefer-readonly-parameter-types': 'error',
|
|
140
|
+
// Enforce using type parameter when calling `Array.reduce()` instead of
|
|
141
|
+
// using a type assertion
|
|
142
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
|
96
143
|
},
|
|
97
144
|
},
|
|
98
145
|
];
|
package/rules/unicorn.mjs
CHANGED
|
@@ -18,7 +18,10 @@ export default [
|
|
|
18
18
|
// Avoid conflicts with Prettier
|
|
19
19
|
'unicorn/escape-case': ['warn', 'lowercase'],
|
|
20
20
|
// Avoid conflicts with Prettier
|
|
21
|
-
'unicorn/number-literal-case': [
|
|
21
|
+
'unicorn/number-literal-case': [
|
|
22
|
+
'warn',
|
|
23
|
+
{ hexadecimalValue: 'lowercase' },
|
|
24
|
+
],
|
|
22
25
|
},
|
|
23
26
|
},
|
|
24
27
|
];
|