@fullstacksjs/eslint-config 10.6.2 → 10.6.3
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 +17 -7
- package/init.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -94,22 +94,32 @@ module.exports = init({
|
|
|
94
94
|
|
|
95
95
|
It's crucial to balance the benefits of linting rules against their performance impact. Below is a table highlighting the most resource-intensive linting rules encountered in a real-world React project:
|
|
96
96
|
|
|
97
|
-
| Rule
|
|
98
|
-
|
|
|
99
|
-
| @cspell/spellchecker
|
|
100
|
-
| prettier/prettier
|
|
101
|
-
| @typescript-eslint/no-misused-promises
|
|
102
|
-
| import/no-cycle
|
|
103
|
-
| import/namespace
|
|
97
|
+
| Rule | Time (ms) | Relative |
|
|
98
|
+
| -------------------------------------- | --------- | -------- |
|
|
99
|
+
| @cspell/spellchecker | 4298.302 | 25.0% |
|
|
100
|
+
| prettier/prettier | 3299.631 | 19.2% |
|
|
101
|
+
| @typescript-eslint/no-misused-promises | 2473.767 | 14.4% |
|
|
102
|
+
| import/no-cycle | 1177.111 | 6.8% |
|
|
103
|
+
| import/namespace | 1148.731 | 6.7% |
|
|
104
104
|
|
|
105
105
|
As illustrated, certain rules significantly increase linting time, potentially hindering the developer experience by slowing down the feedback loop. To mitigate this, you may consider disabling these resource-intensive rules in the development environment. However, they can remain active in environments where performance is less critical, such as Continuous Integration (CI) systems or during pre-commit checks (git hooks).
|
|
106
106
|
|
|
107
107
|
To conditionally disable expensive linting rules, you can modify your configuration as follows:
|
|
108
108
|
|
|
109
|
+
list of expensiveRules to be effected:
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
'@cspell/spellchecker'
|
|
113
|
+
'@typescript-eslint/no-misused-promises'
|
|
114
|
+
'import/no-cycle'
|
|
115
|
+
'import/namespace'
|
|
116
|
+
```
|
|
117
|
+
|
|
109
118
|
```js
|
|
110
119
|
module.exports = init({
|
|
111
120
|
modules: {
|
|
112
121
|
disableExpensiveRules: !process.env.CI || !process.env.HUSKY // Or anywhere you want
|
|
122
|
+
prettier: false // So you should run the formatter explicitly.
|
|
113
123
|
},
|
|
114
124
|
});
|
|
115
125
|
```
|
package/init.js
CHANGED
|
@@ -31,7 +31,7 @@ function init(opts = {}) {
|
|
|
31
31
|
opts.test && require.resolve('./jest'),
|
|
32
32
|
opts.esm && require.resolve('./esm'),
|
|
33
33
|
opts.strict && require.resolve('./strict'),
|
|
34
|
-
|
|
34
|
+
opts.prettier && require.resolve('./prettier'),
|
|
35
35
|
!opts.disableExpensiveRules && opts.cspell && require.resolve('./cspell'),
|
|
36
36
|
]
|
|
37
37
|
.concat(extraExtends)
|