@firefoxic/eslint-config 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/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ # MIT License
2
+
3
+ Copyright © Sergey Artemov <firefoxic.dev@gmail.com>, 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @firefoxic/eslint-config
2
+
3
+ [![Test Status][test-image]][test-url]
4
+ [![License: MIT][license-image]][license-url]
5
+ [![NPM version][npm-image]][npm-url]
6
+
7
+ Shared config for eslint by [firefoxic](https://firefoxic.dev).
8
+
9
+ To see the rules that this config uses, please read the [config itself](./lib/index.js).
10
+
11
+ ## Installation
12
+
13
+ ```shell
14
+ pnpm add eslint @firefoxic/eslint-config -D
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Set your `eslint.config.js` to:
20
+
21
+ ```js
22
+ import { default as firefoxicEslintConfig, globals } from "@firefoxic/eslint-config"
23
+
24
+ export default [
25
+ {
26
+ languageOptions: {
27
+ globals: {
28
+ ...globals.browser, // If you're working on a frontend project
29
+ ...globals.nodeBuiltin, // If you're working on a Node.js project
30
+ },
31
+ },
32
+ },
33
+ ...firefoxicEslintConfig,
34
+ {
35
+ rules: {
36
+ // Your overrides or additions to rules
37
+ }
38
+ }
39
+ ]
40
+ ```
41
+
42
+ ## Useful links
43
+
44
+ - [Changelog](./CHANGELOG.md)
45
+
46
+ [test-url]: https://github.com/firefoxic/eslint-config/actions
47
+ [test-image]: https://github.com/firefoxic/eslint-config/actions/workflows/test.yml/badge.svg?branch=main
48
+
49
+ [npm-url]: https://npmjs.org/package/firefoxic/eslint-config
50
+ [npm-image]: https://badge.fury.io/js/@firefoxic%2Feslint-config.svg
51
+
52
+ [license-url]: https://github.com/firefoxic/eslint-config/eslint-config/blob/main/LICENSE.md
53
+ [license-image]: https://img.shields.io/badge/License-MIT-limegreen.svg
package/lib/index.js ADDED
@@ -0,0 +1,377 @@
1
+ import js from "@eslint/js"
2
+ import stylisticJs from "@stylistic/eslint-plugin-js"
3
+
4
+ export { default as globals } from "globals"
5
+
6
+ export default [
7
+ js.configs.recommended,
8
+ {
9
+ rules: {
10
+ "accessor-pairs": `error`,
11
+ "arrow-body-style": [
12
+ `error`,
13
+ `as-needed`,
14
+ ],
15
+ "camelcase": `error`,
16
+ "curly": [
17
+ `error`,
18
+ `multi-line`,
19
+ ],
20
+ "eqeqeq": [
21
+ `error`,
22
+ `always`,
23
+ ],
24
+ "func-style": [
25
+ `error`,
26
+ `declaration`,
27
+ ],
28
+ "guard-for-in": `error`,
29
+ "no-alert": `error`,
30
+ "no-lonely-if": `error`,
31
+ "no-multi-assign": `error`,
32
+ "no-proto": `error`,
33
+ "no-nested-ternary": `error`,
34
+ "no-octal-escape": `error`,
35
+ "no-prototype-builtins": `error`,
36
+ "no-return-assign": `error`,
37
+ "no-self-compare": `error`,
38
+ "no-shadow": [
39
+ `error`,
40
+ {
41
+ hoist: `all`,
42
+ },
43
+ ],
44
+ "no-template-curly-in-string": `error`,
45
+ "no-unneeded-ternary": `error`,
46
+ "no-unused-expressions": `error`,
47
+ "no-use-before-define": [
48
+ `error`,
49
+ {
50
+ functions: false,
51
+ },
52
+ ],
53
+ "no-useless-concat": `error`,
54
+ "no-useless-return": `error`,
55
+ "no-var": `error`,
56
+ "object-shorthand": `error`,
57
+ "one-var": [
58
+ `error`,
59
+ `never`,
60
+ ],
61
+ "prefer-arrow-callback": `error`,
62
+ "prefer-object-has-own": `error`,
63
+ "prefer-template": `error`,
64
+ "radix": `error`,
65
+ "sort-imports": [
66
+ `error`,
67
+ {
68
+ ignoreCase: true,
69
+ ignoreDeclarationSort: false,
70
+ ignoreMemberSort: false,
71
+ memberSyntaxSortOrder: [
72
+ `single`,
73
+ `multiple`,
74
+ `all`,
75
+ `none`,
76
+ ],
77
+ allowSeparatedGroups: true,
78
+ },
79
+ ],
80
+ "strict": [
81
+ `error`,
82
+ `global`,
83
+ ],
84
+ },
85
+ },
86
+ {
87
+ plugins: {
88
+ "@stylistic/js": stylisticJs,
89
+ },
90
+ rules: {
91
+ "@stylistic/js/array-bracket-newline": [
92
+ `error`,
93
+ // `consistent`,
94
+ { multiline: true },
95
+ ],
96
+ "@stylistic/js/array-bracket-spacing": [
97
+ `error`,
98
+ `never`,
99
+ ],
100
+ "@stylistic/js/array-element-newline": [
101
+ `error`,
102
+ `consistent`,
103
+ ],
104
+ "@stylistic/js/arrow-parens": [
105
+ `error`,
106
+ `always`,
107
+ ],
108
+ "@stylistic/js/arrow-spacing": [
109
+ `error`,
110
+ {
111
+ before: true,
112
+ after: true,
113
+ },
114
+ ],
115
+ "@stylistic/js/block-spacing": [
116
+ `error`,
117
+ `always`,
118
+ ],
119
+ "@stylistic/js/brace-style": [
120
+ `error`,
121
+ `1tbs`,
122
+ {
123
+ allowSingleLine: true,
124
+ },
125
+ ],
126
+ "@stylistic/js/comma-dangle": [
127
+ `error`,
128
+ `always-multiline`,
129
+ ],
130
+ "@stylistic/js/comma-spacing": [
131
+ `error`,
132
+ {
133
+ before: false,
134
+ after: true,
135
+ },
136
+ ],
137
+ "@stylistic/js/comma-style": [
138
+ `error`,
139
+ `last`,
140
+ ],
141
+ "@stylistic/js/computed-property-spacing": [
142
+ `error`,
143
+ `never`,
144
+ ],
145
+ "@stylistic/js/dot-location": [
146
+ `error`,
147
+ `property`,
148
+ ],
149
+ "@stylistic/js/eol-last": [
150
+ `error`,
151
+ `always`,
152
+ ],
153
+ "@stylistic/js/function-call-argument-newline": [
154
+ `error`,
155
+ `consistent`,
156
+ ],
157
+ "@stylistic/js/function-call-spacing": [
158
+ `error`,
159
+ `never`,
160
+ ],
161
+ "@stylistic/js/function-paren-newline": [
162
+ `error`,
163
+ `multiline-arguments`,
164
+ ],
165
+ "@stylistic/js/generator-star-spacing": [
166
+ `error`,
167
+ {
168
+ before: true,
169
+ after: false,
170
+ },
171
+ ],
172
+ "@stylistic/js/implicit-arrow-linebreak": [
173
+ `error`,
174
+ `beside`,
175
+ ],
176
+ "@stylistic/js/indent": [
177
+ `error`,
178
+ `tab`,
179
+ {
180
+ SwitchCase: 1,
181
+ },
182
+ ],
183
+ "@stylistic/js/key-spacing": [
184
+ `error`,
185
+ {
186
+ beforeColon: false,
187
+ afterColon: true,
188
+ },
189
+ ],
190
+ "@stylistic/js/keyword-spacing": [
191
+ `error`,
192
+ {
193
+ before: true,
194
+ after: true,
195
+ },
196
+ ],
197
+ "@stylistic/js/linebreak-style": [
198
+ `error`,
199
+ `unix`,
200
+ ],
201
+ "@stylistic/js/lines-around-comment": [
202
+ `error`,
203
+ {
204
+ beforeBlockComment: true,
205
+ allowBlockStart: true,
206
+ },
207
+ ],
208
+ "@stylistic/js/lines-between-class-members": [
209
+ `error`,
210
+ `always`,
211
+ ],
212
+ "@stylistic/js/max-len": [
213
+ `error`,
214
+ { code: Infinity },
215
+ ],
216
+ "@stylistic/js/multiline-ternary": [
217
+ `error`,
218
+ `always-multiline`,
219
+ ],
220
+ "@stylistic/js/new-parens": [
221
+ `error`,
222
+ `never`,
223
+ ],
224
+ "@stylistic/js/no-extra-semi": [`error`],
225
+ "@stylistic/js/no-floating-decimal": [`error`],
226
+ "@stylistic/js/no-mixed-operators": [
227
+ `error`,
228
+ { allowSamePrecedence: true },
229
+ ],
230
+ "@stylistic/js/no-mixed-spaces-and-tabs": [
231
+ `error`,
232
+ // `smart-tabs`,
233
+ ],
234
+ "@stylistic/js/no-multi-spaces": [
235
+ `error`,
236
+ {
237
+ ignoreEOLComments: true,
238
+ },
239
+ ],
240
+ "@stylistic/js/no-multiple-empty-lines": [
241
+ `error`,
242
+ {
243
+ max: 1,
244
+ },
245
+ ],
246
+ "@stylistic/js/no-trailing-spaces": [`error`],
247
+ "@stylistic/js/no-whitespace-before-property": [`error`],
248
+ "@stylistic/js/nonblock-statement-body-position": [
249
+ `error`,
250
+ `beside`,
251
+ ],
252
+ "@stylistic/js/object-curly-newline": [
253
+ `error`,
254
+ {
255
+ consistent: true,
256
+ multiline: true,
257
+ },
258
+ ],
259
+ "@stylistic/js/object-curly-spacing": [
260
+ `error`,
261
+ `always`,
262
+ ],
263
+ "@stylistic/js/object-property-newline": [
264
+ `error`,
265
+ {
266
+ allowMultiplePropertiesPerLine: true,
267
+ },
268
+ ],
269
+ "@stylistic/js/operator-linebreak": [
270
+ `error`,
271
+ `before`,
272
+ ],
273
+ "@stylistic/js/padded-blocks": [
274
+ `error`,
275
+ `never`,
276
+ ],
277
+ "@stylistic/js/padding-line-between-statements": [
278
+ `error`,
279
+ {
280
+ blankLine: `always`,
281
+ prev: `*`,
282
+ next: [`function`, `const`, `let`, `var`, `export`, `return`],
283
+ },
284
+ {
285
+ blankLine: `always`,
286
+ prev: [`import`, `const`, `let`, `var`, `export`, `function`],
287
+ next: `*`,
288
+ },
289
+ {
290
+ blankLine: `any`,
291
+ prev: [`const`, `let`, `var`],
292
+ next: [`const`, `let`, `var`],
293
+ },
294
+ {
295
+ blankLine: `any`,
296
+ prev: `import`,
297
+ next: `import`,
298
+ },
299
+ ],
300
+ "@stylistic/js/quote-props": [
301
+ `error`,
302
+ `consistent-as-needed`,
303
+ {
304
+ keywords: true,
305
+ },
306
+ ],
307
+ "@stylistic/js/quotes": [
308
+ `error`,
309
+ `backtick`,
310
+ ],
311
+ "@stylistic/js/rest-spread-spacing": [
312
+ `error`,
313
+ `never`,
314
+ ],
315
+ "@stylistic/js/semi": [
316
+ `error`,
317
+ `never`,
318
+ ],
319
+ "@stylistic/js/semi-spacing": [
320
+ `error`,
321
+ {
322
+ before: false,
323
+ after: true,
324
+ },
325
+ ],
326
+ "@stylistic/js/semi-style": [
327
+ `error`,
328
+ `first`,
329
+ ],
330
+ "@stylistic/js/space-before-blocks": [
331
+ `error`,
332
+ `always`,
333
+ ],
334
+ "@stylistic/js/space-before-function-paren": [
335
+ `error`,
336
+ `always`,
337
+ ],
338
+ "@stylistic/js/space-in-parens": [
339
+ `error`,
340
+ `never`,
341
+ ],
342
+ "@stylistic/js/space-infix-ops": [
343
+ `error`,
344
+ { int32Hint: false },
345
+ ],
346
+ "@stylistic/js/space-unary-ops": [`error`],
347
+ "@stylistic/js/spaced-comment": [
348
+ `error`,
349
+ `always`,
350
+ ],
351
+ "@stylistic/js/switch-colon-spacing": [
352
+ `error`,
353
+ {
354
+ before: false,
355
+ after: true,
356
+ },
357
+ ],
358
+ "@stylistic/js/template-curly-spacing": [
359
+ `error`,
360
+ `never`,
361
+ ],
362
+ "@stylistic/js/template-tag-spacing": [
363
+ `error`,
364
+ `never`,
365
+ ],
366
+ "@stylistic/js/wrap-iife": [
367
+ `error`,
368
+ `outside`,
369
+ ],
370
+ "@stylistic/js/wrap-regex": [`error`],
371
+ "@stylistic/js/yield-star-spacing": [
372
+ `error`,
373
+ `before`,
374
+ ],
375
+ },
376
+ },
377
+ ]
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@firefoxic/eslint-config",
3
+ "description": "Shared config for eslint by firefoxic.",
4
+ "version": "1.0.0",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "Sergey Artemov",
8
+ "email": "firefoxic.dev@gmail.com"
9
+ },
10
+ "homepage": "https://github.com/firefoxic/eslint-config#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/firefoxic/eslint-config/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/firefoxic/eslint-config.git"
17
+ },
18
+ "type": "module",
19
+ "engines": {
20
+ "node": "^18.12 || >=20.9"
21
+ },
22
+ "exports": "./lib/index.js",
23
+ "files": [
24
+ "./lib/index.js"
25
+ ],
26
+ "peerDependencies": {
27
+ "eslint": "^9.2.0"
28
+ },
29
+ "dependencies": {
30
+ "@eslint/js": "^9.2.0",
31
+ "@stylistic/eslint-plugin-js": "^1.8.0",
32
+ "globals": "15.1.0"
33
+ },
34
+ "devDependencies": {
35
+ "@firefoxic/utils": "^0.1.1",
36
+ "eslint": "^9.2.0",
37
+ "husky": "^9.0.11"
38
+ },
39
+ "keywords": [
40
+ "config",
41
+ "eslint",
42
+ "javascript",
43
+ "js",
44
+ "lint",
45
+ "linter",
46
+ "linting"
47
+ ],
48
+ "scripts": {
49
+ "lint": "eslint",
50
+ "pretest": "pnpm lint",
51
+ "test": "node --test",
52
+ "preversion": "pnpm test",
53
+ "version": "update-changelog && git add CHANGELOG.md",
54
+ "postversion": "pnpm publish --access=public"
55
+ }
56
+ }