@croct/eslint-plugin 0.8.2 → 0.9.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 +65 -29
- package/index.cjs +380324 -0
- package/index.d.cts +45 -0
- package/package.json +69 -50
- package/configs/cypress.js +0 -29
- package/configs/index.js +0 -12
- package/configs/javascript.js +0 -867
- package/configs/react.js +0 -355
- package/configs/typescript.js +0 -117
- package/index.js +0 -30
- package/rules/argument-spacing/index.js +0 -70
- package/rules/complex-expression-spacing/index.js +0 -66
- package/rules/createRule.js +0 -5
- package/rules/index.js +0 -17
- package/rules/jsx-attribute-spacing/index.js +0 -60
- package/rules/min-chained-call-depth/index.js +0 -158
- package/rules/newline-per-chained-call/index.js +0 -119
- package/rules/parameter-destructuring/index.js +0 -60
package/README.md
CHANGED
|
@@ -30,50 +30,86 @@ Webpack or Browserify:
|
|
|
30
30
|
npm i -D @croct/eslint-plugin
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
This plugin uses ESLint's [flat config format](https://eslint.org/docs/latest/use/configure/configuration-files) (ESLint v9+).
|
|
34
|
+
|
|
35
|
+
### JavaScript
|
|
36
|
+
|
|
37
|
+
For JavaScript projects, create an `eslint.config.mjs` file:
|
|
34
38
|
|
|
35
39
|
```js
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
import { defineConfig } from 'eslint/config';
|
|
41
|
+
import croct from '@croct/eslint-plugin';
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
export default defineConfig(
|
|
44
|
+
croct.configs.javascript,
|
|
45
|
+
);
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
Note the `require` call at the top of the file. This is a workaround to avoid adding the transitive dependencies of
|
|
45
|
-
the plugin to the project, which is [currently not supported by the ESLint plugin system](https://github.com/eslint/eslint/issues/3458).
|
|
46
|
-
|
|
47
48
|
### TypeScript
|
|
48
49
|
|
|
49
|
-
For TypeScript projects,
|
|
50
|
+
For TypeScript projects, create an `eslint.config.mjs` file:
|
|
50
51
|
|
|
51
|
-
```
|
|
52
|
-
|
|
52
|
+
```js
|
|
53
|
+
import { defineConfig } from 'eslint/config';
|
|
54
|
+
import croct from '@croct/eslint-plugin';
|
|
55
|
+
|
|
56
|
+
export default defineConfig(
|
|
57
|
+
croct.configs.typescript,
|
|
58
|
+
);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The TypeScript config includes the JavaScript preset, so there's no need to include both.
|
|
62
|
+
|
|
63
|
+
### React
|
|
64
|
+
|
|
65
|
+
For React projects, create an `eslint.config.mjs` file:
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
import { defineConfig } from 'eslint/config';
|
|
69
|
+
import croct from '@croct/eslint-plugin';
|
|
70
|
+
|
|
71
|
+
export default defineConfig(
|
|
72
|
+
croct.configs.react,
|
|
73
|
+
);
|
|
53
74
|
```
|
|
54
75
|
|
|
55
|
-
|
|
76
|
+
The React config includes the JavaScript preset, so there's no need to include both.
|
|
77
|
+
|
|
78
|
+
### Cypress
|
|
79
|
+
|
|
80
|
+
For Cypress projects, create an `eslint.config.mjs` file:
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
import { defineConfig } from 'eslint/config';
|
|
84
|
+
import croct from '@croct/eslint-plugin';
|
|
85
|
+
|
|
86
|
+
export default defineConfig(
|
|
87
|
+
croct.configs.cypress,
|
|
88
|
+
);
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The Cypress config includes the JavaScript preset, so there's no need to include both.
|
|
92
|
+
|
|
93
|
+
### Custom rules
|
|
94
|
+
|
|
95
|
+
You can add custom rules or override existing ones:
|
|
56
96
|
|
|
57
97
|
```js
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
],
|
|
69
|
-
"parserOptions": {
|
|
70
|
-
"extends": "./tsconfig.json",
|
|
71
|
-
"project": ["./tsconfig.json"]
|
|
98
|
+
import { defineConfig } from 'eslint/config';
|
|
99
|
+
import croct from '@croct/eslint-plugin';
|
|
100
|
+
|
|
101
|
+
export default defineConfig(
|
|
102
|
+
croct.configs.typescript,
|
|
103
|
+
{
|
|
104
|
+
files: ['src/**/*.ts'],
|
|
105
|
+
rules: {
|
|
106
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
107
|
+
},
|
|
72
108
|
},
|
|
73
|
-
|
|
109
|
+
);
|
|
74
110
|
```
|
|
75
111
|
|
|
76
|
-
For the list
|
|
112
|
+
For the list of available presets and rules, see the [reference documentation](docs/README.md).
|
|
77
113
|
|
|
78
114
|
## Basic usage
|
|
79
115
|
|