@citrus-linting/eslint-config 0.21.1 → 1.0.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 +105 -161
- package/index.js +21 -11
- package/package.json +11 -7
- package/rules/base.js +210 -318
- package/rules/svelte.js +64 -82
- package/rules/typescript.js +208 -243
- package/svelte-typescript.js +23 -11
- package/svelte.js +18 -9
- package/typescript.js +19 -11
- package/jest.js +0 -12
- package/jsdoc.js +0 -9
- package/json.js +0 -10
- package/rules/jest.js +0 -45
- package/rules/jsdoc.js +0 -59
- package/rules/json.js +0 -44
- package/rules/yaml.js +0 -28
- package/yaml.js +0 -10
package/README.md
CHANGED
|
@@ -8,10 +8,6 @@ ESLint config used by [CitRUS](https://github.com/CitRUSprod).
|
|
|
8
8
|
2. [TypeScript](#typescript)
|
|
9
9
|
3. [Svelte](#svelte)
|
|
10
10
|
4. [Svelte TypeScript](#svelte-typescript)
|
|
11
|
-
5. [JSON](#json)
|
|
12
|
-
6. [YAML](#yaml)
|
|
13
|
-
7. [Jest](#jest)
|
|
14
|
-
8. [JSDoc](#jsdoc)
|
|
15
11
|
|
|
16
12
|
## Usage
|
|
17
13
|
|
|
@@ -20,205 +16,153 @@ ESLint config used by [CitRUS](https://github.com/CitRUSprod).
|
|
|
20
16
|
Install dependencies:
|
|
21
17
|
|
|
22
18
|
```sh
|
|
23
|
-
npm add -D @citrus-linting/eslint-config
|
|
19
|
+
npm add -D globals @citrus-linting/eslint-config
|
|
24
20
|
```
|
|
25
21
|
|
|
26
|
-
Add `extends` field to your ESLint config:
|
|
22
|
+
Add `extends` field to your ESLint config (eslint.config.js):
|
|
27
23
|
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
"extends": ["@citrus-linting"]
|
|
31
|
-
// your options
|
|
32
|
-
}
|
|
24
|
+
```javascript
|
|
25
|
+
import baseConfig from "@citrus-linting/eslint-config"
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
27
|
+
export default [
|
|
28
|
+
...baseConfig
|
|
29
|
+
// your configs
|
|
30
|
+
]
|
|
39
31
|
```
|
|
40
32
|
|
|
41
|
-
|
|
33
|
+
or only rules:
|
|
42
34
|
|
|
43
|
-
|
|
35
|
+
```javascript
|
|
36
|
+
import baseRules from "@citrus-linting/eslint-config/rules/base"
|
|
44
37
|
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
export default [
|
|
39
|
+
{
|
|
40
|
+
files: ["**/*.js"],
|
|
41
|
+
rules: {
|
|
42
|
+
...baseRules
|
|
43
|
+
// your rules
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```jsonc
|
|
52
|
-
{
|
|
53
|
-
"extends": ["@citrus-linting", "@citrus-linting/eslint-config/typescript"]
|
|
54
|
-
// your options
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// or only rules
|
|
58
|
-
{
|
|
59
|
-
"extends": [
|
|
60
|
-
"@citrus-linting/eslint-config/rules/base",
|
|
61
|
-
"@citrus-linting/eslint-config/rules/typescript"
|
|
62
|
-
]
|
|
63
|
-
// your options
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Svelte
|
|
49
|
+
### TypeScript
|
|
68
50
|
|
|
69
51
|
Install dependencies:
|
|
70
52
|
|
|
71
53
|
```sh
|
|
72
|
-
npm add -D
|
|
54
|
+
npm add -D globals typescript-eslint @citrus-linting/eslint-config
|
|
73
55
|
```
|
|
74
56
|
|
|
75
|
-
Add `extends` field to your ESLint config:
|
|
76
|
-
|
|
77
|
-
```jsonc
|
|
78
|
-
{
|
|
79
|
-
"extends": ["@citrus-linting", "@citrus-linting/eslint-config/svelte"]
|
|
80
|
-
// your options
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// or only rules
|
|
84
|
-
{
|
|
85
|
-
"extends": [
|
|
86
|
-
"@citrus-linting/eslint-config/rules/base",
|
|
87
|
-
"@citrus-linting/eslint-config/rules/svelte"
|
|
88
|
-
]
|
|
89
|
-
// your options
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Svelte TypeScript
|
|
57
|
+
Add `extends` field to your ESLint config (eslint.config.js):
|
|
94
58
|
|
|
95
|
-
|
|
59
|
+
```javascript
|
|
60
|
+
import baseConfig from "@citrus-linting/eslint-config"
|
|
61
|
+
import typescriptConfig from "@citrus-linting/eslint-config/typescript"
|
|
96
62
|
|
|
97
|
-
|
|
98
|
-
|
|
63
|
+
export default [
|
|
64
|
+
...baseConfig,
|
|
65
|
+
...typescriptConfig
|
|
66
|
+
// your configs
|
|
67
|
+
]
|
|
99
68
|
```
|
|
100
69
|
|
|
101
|
-
|
|
70
|
+
or only rules:
|
|
102
71
|
|
|
103
|
-
|
|
72
|
+
```javascript
|
|
73
|
+
import baseRules from "@citrus-linting/eslint-config/rules/base"
|
|
74
|
+
import typescriptRules from "@citrus-linting/eslint-config/rules/typescript"
|
|
104
75
|
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"@citrus-linting/eslint-config/rules/typescript",
|
|
116
|
-
"@citrus-linting/eslint-config/rules/svelte"
|
|
117
|
-
]
|
|
118
|
-
// your options
|
|
119
|
-
}
|
|
76
|
+
export default [
|
|
77
|
+
{
|
|
78
|
+
files: ["**/*.ts"],
|
|
79
|
+
rules: {
|
|
80
|
+
...baseRules,
|
|
81
|
+
...typescriptRules
|
|
82
|
+
// your rules
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
]
|
|
120
86
|
```
|
|
121
87
|
|
|
122
|
-
###
|
|
88
|
+
### Svelte
|
|
123
89
|
|
|
124
90
|
Install dependencies:
|
|
125
91
|
|
|
126
92
|
```sh
|
|
127
|
-
npm add -D
|
|
93
|
+
npm add -D globals svelte-eslint-parser eslint-plugin-svelte @citrus-linting/eslint-config
|
|
128
94
|
```
|
|
129
95
|
|
|
130
|
-
Add `extends` field to your ESLint config:
|
|
131
|
-
|
|
132
|
-
```jsonc
|
|
133
|
-
{
|
|
134
|
-
"extends": ["@citrus-linting", "@citrus-linting/eslint-config/json"]
|
|
135
|
-
// your options
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// or only rules
|
|
139
|
-
{
|
|
140
|
-
"extends": [
|
|
141
|
-
"@citrus-linting/eslint-config/rules/base",
|
|
142
|
-
"@citrus-linting/eslint-config/rules/json"
|
|
143
|
-
]
|
|
144
|
-
// your options
|
|
145
|
-
}
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### YAML
|
|
96
|
+
Add `extends` field to your ESLint config (eslint.config.js):
|
|
149
97
|
|
|
150
|
-
|
|
98
|
+
```javascript
|
|
99
|
+
import baseConfig from "@citrus-linting/eslint-config"
|
|
100
|
+
import svelteConfig from "@citrus-linting/eslint-config/svelte"
|
|
151
101
|
|
|
152
|
-
|
|
153
|
-
|
|
102
|
+
export default [
|
|
103
|
+
...baseConfig,
|
|
104
|
+
...svelteConfig
|
|
105
|
+
// your configs
|
|
106
|
+
]
|
|
154
107
|
```
|
|
155
108
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
```jsonc
|
|
159
|
-
{
|
|
160
|
-
"extends": ["@citrus-linting", "@citrus-linting/eslint-config/yaml"]
|
|
161
|
-
// your options
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// or only rules
|
|
165
|
-
{
|
|
166
|
-
"extends": [
|
|
167
|
-
"@citrus-linting/eslint-config/rules/base",
|
|
168
|
-
"@citrus-linting/eslint-config/rules/yaml"
|
|
169
|
-
]
|
|
170
|
-
// your options
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Jest
|
|
175
|
-
|
|
176
|
-
Install dependencies:
|
|
109
|
+
or only rules:
|
|
177
110
|
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
|
|
111
|
+
```javascript
|
|
112
|
+
import baseRules from "@citrus-linting/eslint-config/rules/base"
|
|
113
|
+
import svelteRules from "@citrus-linting/eslint-config/rules/svelte"
|
|
181
114
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
"extends": [
|
|
193
|
-
"@citrus-linting/eslint-config/rules/base",
|
|
194
|
-
"@citrus-linting/eslint-config/rules/jest"
|
|
195
|
-
]
|
|
196
|
-
// your options
|
|
197
|
-
}
|
|
115
|
+
export default [
|
|
116
|
+
{
|
|
117
|
+
files: ["**/*.svelte"],
|
|
118
|
+
rules: {
|
|
119
|
+
...baseRules,
|
|
120
|
+
...svelteRules
|
|
121
|
+
// your rules
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
198
125
|
```
|
|
199
126
|
|
|
200
|
-
###
|
|
127
|
+
### Svelte TypeScript
|
|
201
128
|
|
|
202
129
|
Install dependencies:
|
|
203
130
|
|
|
204
131
|
```sh
|
|
205
|
-
npm add -D eslint-plugin-
|
|
132
|
+
npm add -D globals svelte-eslint-parser eslint-plugin-svelte typescript-eslint @citrus-linting/eslint-config
|
|
206
133
|
```
|
|
207
134
|
|
|
208
|
-
Add `extends` field to your ESLint config:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
135
|
+
Add `extends` field to your ESLint config (eslint.config.js):
|
|
136
|
+
|
|
137
|
+
> **NOTE:** Need tsconfig.eslint.json file.
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
import baseConfig from "@citrus-linting/eslint-config"
|
|
141
|
+
import svelteTypescriptConfig from "@citrus-linting/eslint-config/svelte-typescript"
|
|
142
|
+
|
|
143
|
+
export default [
|
|
144
|
+
...baseConfig,
|
|
145
|
+
...svelteTypescriptConfig
|
|
146
|
+
// your configs
|
|
147
|
+
]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
or only rules:
|
|
151
|
+
|
|
152
|
+
```javascript
|
|
153
|
+
import baseRules from "@citrus-linting/eslint-config/rules/base"
|
|
154
|
+
import typescriptRules from "@citrus-linting/eslint-config/rules/typescript"
|
|
155
|
+
import svelteRules from "@citrus-linting/eslint-config/rules/svelte"
|
|
156
|
+
|
|
157
|
+
export default [
|
|
158
|
+
{
|
|
159
|
+
files: ["**/*.svelte"],
|
|
160
|
+
rules: {
|
|
161
|
+
...baseRules,
|
|
162
|
+
...typescriptRules,
|
|
163
|
+
...svelteRules
|
|
164
|
+
// your rules
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
]
|
|
224
168
|
```
|
package/index.js
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const globals = require("globals")
|
|
2
|
+
|
|
3
|
+
const baseRules = require("./rules/base")
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
{
|
|
7
|
+
languageOptions: {
|
|
8
|
+
ecmaVersion: 2024,
|
|
9
|
+
sourceType: "module",
|
|
10
|
+
globals: {
|
|
11
|
+
...globals.browser,
|
|
12
|
+
...globals.node,
|
|
13
|
+
...globals.es6
|
|
14
|
+
}
|
|
15
|
+
}
|
|
7
16
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
{
|
|
18
|
+
files: ["**/*.?([cm])js"],
|
|
19
|
+
rules: {
|
|
20
|
+
...baseRules
|
|
21
|
+
}
|
|
12
22
|
}
|
|
13
|
-
|
|
23
|
+
]
|
package/package.json
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citrus-linting/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "ESLint config used by CitRUS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
7
7
|
"eslint",
|
|
8
8
|
"javascript",
|
|
9
9
|
"typescript",
|
|
10
|
-
"svelte"
|
|
11
|
-
"json",
|
|
12
|
-
"yaml",
|
|
13
|
-
"jest",
|
|
14
|
-
"jsdoc"
|
|
10
|
+
"svelte"
|
|
15
11
|
],
|
|
16
12
|
"homepage": "https://github.com/CitRUSprod/citrus-linting#readme",
|
|
17
13
|
"repository": {
|
|
@@ -21,7 +17,15 @@
|
|
|
21
17
|
},
|
|
22
18
|
"license": "MIT",
|
|
23
19
|
"author": "CitRUS",
|
|
24
|
-
"
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./index.js",
|
|
22
|
+
"./typescript": "./typescript.js",
|
|
23
|
+
"./svelte": "./svelte.js",
|
|
24
|
+
"./svelte-typescript": "./svelte-typescript.js",
|
|
25
|
+
"./rules/base": "./rules/base.js",
|
|
26
|
+
"./rules/typescript": "./rules/typescript.js",
|
|
27
|
+
"./rules/svelte": "./rules/svelte.js"
|
|
28
|
+
},
|
|
25
29
|
"publishConfig": {
|
|
26
30
|
"access": "public"
|
|
27
31
|
}
|