@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 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
- ```jsonc
29
- {
30
- "extends": ["@citrus-linting"]
31
- // your options
32
- }
24
+ ```javascript
25
+ import baseConfig from "@citrus-linting/eslint-config"
33
26
 
34
- // or only rules
35
- {
36
- "extends": ["@citrus-linting/eslint-config/rules/base"]
37
- // your options
38
- }
27
+ export default [
28
+ ...baseConfig
29
+ // your configs
30
+ ]
39
31
  ```
40
32
 
41
- ### TypeScript
33
+ or only rules:
42
34
 
43
- Install dependencies:
35
+ ```javascript
36
+ import baseRules from "@citrus-linting/eslint-config/rules/base"
44
37
 
45
- ```sh
46
- npm add -D @typescript-eslint/parser @typescript-eslint/eslint-plugin @citrus-linting/eslint-config
38
+ export default [
39
+ {
40
+ files: ["**/*.js"],
41
+ rules: {
42
+ ...baseRules
43
+ // your rules
44
+ }
45
+ }
46
+ ]
47
47
  ```
48
48
 
49
- Add `extends` field to your ESLint config:
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 svelte-eslint-parser eslint-plugin-svelte @citrus-linting/eslint-config
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
- Install dependencies:
59
+ ```javascript
60
+ import baseConfig from "@citrus-linting/eslint-config"
61
+ import typescriptConfig from "@citrus-linting/eslint-config/typescript"
96
62
 
97
- ```sh
98
- npm add -D svelte-eslint-parser eslint-plugin-svelte @typescript-eslint/parser @typescript-eslint/eslint-plugin @citrus-linting/eslint-config
63
+ export default [
64
+ ...baseConfig,
65
+ ...typescriptConfig
66
+ // your configs
67
+ ]
99
68
  ```
100
69
 
101
- Add `extends` field to your ESLint config:
70
+ or only rules:
102
71
 
103
- > **NOTE:** Need tsconfig.eslint.json file.
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
- ```jsonc
106
- {
107
- "extends": ["@citrus-linting", "@citrus-linting/eslint-config/svelte-typescript"]
108
- // your options
109
- }
110
-
111
- // or only rules
112
- {
113
- "extends": [
114
- "@citrus-linting/eslint-config/rules/base",
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
- ### JSON
88
+ ### Svelte
123
89
 
124
90
  Install dependencies:
125
91
 
126
92
  ```sh
127
- npm add -D jsonc-eslint-parser eslint-plugin-jsonc @citrus-linting/eslint-config
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
- Install dependencies:
98
+ ```javascript
99
+ import baseConfig from "@citrus-linting/eslint-config"
100
+ import svelteConfig from "@citrus-linting/eslint-config/svelte"
151
101
 
152
- ```sh
153
- npm add -D yaml-eslint-parser eslint-plugin-yml @citrus-linting/eslint-config
102
+ export default [
103
+ ...baseConfig,
104
+ ...svelteConfig
105
+ // your configs
106
+ ]
154
107
  ```
155
108
 
156
- Add `extends` field to your ESLint config:
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
- ```sh
179
- npm add -D eslint-plugin-jest @citrus-linting/eslint-config
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
- Add `extends` field to your ESLint config:
183
-
184
- ```jsonc
185
- {
186
- "extends": ["@citrus-linting", "@citrus-linting/eslint-config/jest"]
187
- // your options
188
- }
189
-
190
- // or only rules
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
- ### JSDoc
127
+ ### Svelte TypeScript
201
128
 
202
129
  Install dependencies:
203
130
 
204
131
  ```sh
205
- npm add -D eslint-plugin-jsdoc @citrus-linting/eslint-config
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
- ```jsonc
211
- {
212
- "extends": ["@citrus-linting", "@citrus-linting/eslint-config/jsdoc"]
213
- // your options
214
- }
215
-
216
- // or only rules
217
- {
218
- "extends": [
219
- "@citrus-linting/eslint-config/rules/base",
220
- "@citrus-linting/eslint-config/rules/jsdoc"
221
- ]
222
- // your options
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
- module.exports = {
2
- extends: ["./rules/base"],
3
- root: true,
4
- parserOptions: {
5
- sourceType: "module",
6
- ecmaVersion: 2020
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
- env: {
9
- browser: true,
10
- node: true,
11
- es6: true
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.21.1",
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
- "main": "index.js",
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
  }