@luxass/eslint-config 2.2.6 → 3.0.1

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/index.js CHANGED
@@ -2,6 +2,11 @@ const { isPackageExists } = require("local-pkg");
2
2
 
3
3
  const TS = isPackageExists("typescript");
4
4
 
5
+ if (!TS) {
6
+ console.warn(
7
+ "[@luxass/eslint-config] TypeScript is not installed, fallback to JS only."
8
+ );
9
+ }
5
10
  module.exports = {
6
- extends: [TS ? "./typescript" : "./basic"]
11
+ extends: [TS ? "@luxass/eslint-config-ts" : "@luxass/eslint-config-js"]
7
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxass/eslint-config",
3
- "version": "2.2.6",
3
+ "version": "3.0.1",
4
4
  "description": "luxass' ESLint config",
5
5
  "author": {
6
6
  "name": "Lucas Norgaard",
@@ -10,14 +10,11 @@
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "https://github.com/luxass/eslint-config.git"
13
+ "url": "https://github.com/luxass/eslint-config.git",
14
+ "directory": "packages/eslint-config"
14
15
  },
15
16
  "keywords": [
16
- "eslint-config",
17
- "eslint",
18
- "config",
19
- "eslintconfig",
20
- "eslint config"
17
+ "eslint-config"
21
18
  ],
22
19
  "main": "index.js",
23
20
  "files": [
@@ -28,30 +25,15 @@
28
25
  "typescript": "^4.9.4"
29
26
  },
30
27
  "dependencies": {
31
- "@typescript-eslint/eslint-plugin": "^5.46.1",
32
- "@typescript-eslint/parser": "^5.46.1",
33
- "eslint-config-standard": "^17.0.0",
34
- "eslint-plugin-eslint-comments": "^3.2.0",
35
- "eslint-plugin-html": "^7.1.0",
36
- "eslint-plugin-import": "^2.26.0",
37
- "eslint-plugin-jsonc": "^2.5.0",
38
- "eslint-plugin-markdown": "^3.0.0",
39
- "eslint-plugin-n": "^15.6.0",
40
- "eslint-plugin-promise": "^6.1.1",
41
- "eslint-plugin-react": "^7.31.11",
42
- "eslint-plugin-react-hooks": "^4.6.0",
43
- "eslint-plugin-unicorn": "^45.0.2",
44
- "eslint-plugin-yml": "^1.3.0",
45
- "jsonc-eslint-parser": "^2.1.0",
46
- "local-pkg": "^0.4.2"
28
+ "local-pkg": "^0.4.2",
29
+ "@luxass/eslint-config-js": "3.0.1",
30
+ "@luxass/eslint-config-ts": "3.0.1"
47
31
  },
48
32
  "devDependencies": {
49
- "@luxass/prettier-config": "^1.1.4",
50
33
  "eslint": "^8.30.0",
51
- "prettier": "^2.8.1",
52
- "typescript": "^4.9.4"
34
+ "typescript": "^4.9.5"
53
35
  },
54
36
  "scripts": {
55
- "lint": "eslint --cache *.js"
37
+ "lint": "eslint . --config=index.js"
56
38
  }
57
39
  }
package/README.md DELETED
@@ -1,18 +0,0 @@
1
- # @luxass/eslint-config
2
-
3
- > A shareable ESLINT Config based on [@antfu/eslint-config](https://github.com/antfu/eslint-config)
4
-
5
- ## Installation
6
-
7
- ```bash
8
- pnpm add -D eslint @luxass/eslint-config
9
- ```
10
-
11
- ## Usage
12
-
13
- `.eslintrc`
14
- ```json
15
- {
16
- "extends": "@luxass"
17
- }
18
- ```
package/basic.js DELETED
@@ -1,343 +0,0 @@
1
- module.exports = {
2
- env: {
3
- es6: true,
4
- browser: true,
5
- node: true
6
- },
7
- reportUnusedDisableDirectives: true,
8
- extends: [
9
- "eslint-config-standard",
10
- "plugin:import/recommended",
11
- "plugin:eslint-comments/recommended",
12
- "plugin:jsonc/recommended-with-jsonc",
13
- "plugin:yml/standard",
14
- "plugin:markdown/recommended"
15
- ],
16
- ignorePatterns: [
17
- "*.min.*",
18
- "*.d.ts",
19
- "CHANGELOG.md",
20
- "dist",
21
- "build",
22
- "out",
23
- "output",
24
- "LICENSE*",
25
- "coverage",
26
- "public",
27
- "package-lock.json",
28
- "pnpm-lock.yaml",
29
- "yarn.lock",
30
- "!.github",
31
- "!.vscode"
32
- ],
33
- plugins: ["html", "unicorn"],
34
- settings: {
35
- "import/resolver": {
36
- node: { extensions: [".js", ".mjs"] }
37
- }
38
- },
39
- overrides: [
40
- {
41
- files: ["*.json", "*.json5"],
42
- parser: "jsonc-eslint-parser",
43
- rules: {
44
- "jsonc/array-bracket-spacing": ["error", "never"],
45
- "jsonc/comma-dangle": ["error", "never"],
46
- "jsonc/comma-style": ["error", "last"],
47
- "jsonc/indent": ["error", 2],
48
- "jsonc/key-spacing": [
49
- "error",
50
- { beforeColon: false, afterColon: true }
51
- ],
52
- "jsonc/no-octal-escape": "error",
53
- "jsonc/object-curly-newline": [
54
- "error",
55
- { multiline: true, consistent: true }
56
- ],
57
- "jsonc/object-curly-spacing": ["error", "always"],
58
- "jsonc/object-property-newline": [
59
- "error",
60
- { allowMultiplePropertiesPerLine: true }
61
- ]
62
- }
63
- },
64
- {
65
- files: ["*.yaml", "*.yml"],
66
- parser: "yaml-eslint-parser",
67
- rules: {
68
- "spaced-comment": "off"
69
- }
70
- },
71
- {
72
- files: ["package.json"],
73
- parser: "jsonc-eslint-parser",
74
- rules: {
75
- "jsonc/sort-keys": [
76
- "error",
77
- {
78
- pathPattern: "^$",
79
- order: [
80
- "name",
81
- "publisher",
82
- "displayName",
83
- "type",
84
- "version",
85
- "private",
86
- "description",
87
- "author",
88
- "license",
89
- "funding",
90
- "homepage",
91
- "repository",
92
- "bugs",
93
- "keywords",
94
- "categories",
95
- "sideEffects",
96
- "exports",
97
- "main",
98
- "module",
99
- "types",
100
- "typesVersions",
101
- "bin",
102
- "icon",
103
- "files",
104
- "engines",
105
- "packageManager",
106
- "activationEvents",
107
- "contributes",
108
- "scripts",
109
- "peerDependencies",
110
- "peerDependenciesMeta",
111
- "dependencies",
112
- "optionalDependencies",
113
- "devDependencies",
114
- "pnpm",
115
- "overrides",
116
- "resolutions",
117
- "eslintConfig"
118
- ]
119
- },
120
- {
121
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$",
122
- order: { type: "asc" }
123
- },
124
- {
125
- pathPattern: "^exports.*$",
126
- order: ["types", "require", "import"]
127
- }
128
- ]
129
- }
130
- },
131
- {
132
- files: ["*.d.ts"],
133
- rules: {
134
- "import/no-duplicates": "off"
135
- }
136
- },
137
- {
138
- files: ["*.js"],
139
- rules: {
140
- "@typescript-eslint/no-var-requires": "off"
141
- }
142
- },
143
- {
144
- files: ["*.ts", "*.tsx", "*.mts", "*.cts"],
145
- rules: {
146
- "no-void": ["error", { allowAsStatement: true }]
147
- }
148
- },
149
- {
150
- files: ["scripts/**/*.*", "cli.*"],
151
- rules: {
152
- "no-console": "off"
153
- }
154
- },
155
- {
156
- files: ["*.test.ts", "*.test.js", "*.spec.ts", "*.spec.js"],
157
- rules: {
158
- "no-unused-expressions": "off"
159
- }
160
- },
161
- {
162
- files: ["**/*.md/*.*"],
163
- rules: {
164
- "@typescript-eslint/no-redeclare": "off",
165
- "@typescript-eslint/no-unused-vars": "off",
166
- "@typescript-eslint/no-use-before-define": "off",
167
- "@typescript-eslint/no-var-requires": "off",
168
- "@typescript-eslint/comma-dangle": "off",
169
- "@typescript-eslint/consistent-type-imports": "off",
170
- "import/no-unresolved": "off",
171
- "no-alert": "off",
172
- "no-console": "off",
173
- "no-restricted-imports": "off",
174
- "no-undef": "off",
175
- "no-unused-expressions": "off",
176
- "no-unused-vars": "off"
177
- }
178
- },
179
- {
180
- files: [".github/workflows/*.yml"],
181
- rules: {
182
- "yml/no-empty-mapping-value": "off"
183
- }
184
- }
185
- ],
186
- rules: {
187
- "import/order": "error",
188
- "import/first": "error",
189
- "import/no-mutable-exports": "error",
190
- "import/no-unresolved": "off",
191
- "import/no-absolute-path": "off",
192
- "semi": ["warn", "always"],
193
- "quotes": ["error", "double"],
194
- "quote-props": ["error", "consistent-as-needed"],
195
- "no-unused-vars": "warn",
196
- "no-param-reassign": "off",
197
- "array-bracket-spacing": ["error", "never"],
198
- "block-spacing": ["error", "always"],
199
- "camelcase": "off",
200
- "comma-spacing": ["error", { before: false, after: true }],
201
- "comma-style": ["error", "last"],
202
- "comma-dangle": ["error", "never"],
203
- "no-constant-condition": "warn",
204
- "no-debugger": "error",
205
- "no-console": ["warn", { allow: ["warn", "error", "info"] }],
206
- "no-cond-assign": ["error", "always"],
207
- "func-call-spacing": ["off", "never"],
208
- "key-spacing": ["error", { beforeColon: false, afterColon: true }],
209
- "indent": [
210
- "error",
211
- 2,
212
- { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 }
213
- ],
214
- "no-restricted-syntax": [
215
- "error",
216
- "DebuggerStatement",
217
- "LabeledStatement",
218
- "WithStatement"
219
- ],
220
- "object-curly-spacing": ["error", "always"],
221
- "no-return-await": "off",
222
- "space-before-function-paren": [
223
- "error",
224
- {
225
- anonymous: "always",
226
- named: "never",
227
- asyncArrow: "always"
228
- }
229
- ],
230
- "no-multiple-empty-lines": ["warn", { max: 1, maxBOF: 0, maxEOF: 0 }],
231
- "no-var": "error",
232
- "prefer-const": [
233
- "error",
234
- {
235
- destructuring: "any",
236
- ignoreReadBeforeAssign: true
237
- }
238
- ],
239
- "prefer-arrow-callback": [
240
- "error",
241
- {
242
- allowNamedFunctions: false,
243
- allowUnboundThis: true
244
- }
245
- ],
246
- "object-shorthand": [
247
- "error",
248
- "always",
249
- {
250
- ignoreConstructors: false,
251
- avoidQuotes: true
252
- }
253
- ],
254
- "prefer-exponentiation-operator": "error",
255
- "prefer-rest-params": "error",
256
- "prefer-spread": "error",
257
- "prefer-template": "error",
258
- "template-curly-spacing": "error",
259
- "arrow-parens": ["error", "always"],
260
- "generator-star-spacing": "off",
261
- "spaced-comment": [
262
- "error",
263
- "always",
264
- {
265
- line: {
266
- markers: ["/"],
267
- exceptions: ["/", "#"]
268
- },
269
- block: {
270
- markers: ["!"],
271
- exceptions: ["*"],
272
- balanced: true
273
- }
274
- }
275
- ],
276
- "array-callback-return": "error",
277
- "block-scoped-var": "error",
278
- "consistent-return": "off",
279
- "complexity": ["off", 11],
280
- "eqeqeq": ["error", "smart"],
281
- "no-alert": "warn",
282
- "no-case-declarations": "error",
283
- "no-multi-spaces": "error",
284
- "no-multi-str": "error",
285
- "no-with": "error",
286
- "no-void": "error",
287
- "no-useless-escape": "off",
288
- "vars-on-top": "error",
289
- "require-await": "off",
290
- "no-return-assign": "off",
291
- "operator-linebreak": ["error", "after"],
292
- "max-statements-per-line": ["error", { max: 1 }],
293
-
294
- // unicorns
295
- // Pass error message when throwing errors
296
- "unicorn/error-message": "error",
297
- // Uppercase regex escapes
298
- "unicorn/escape-case": "error",
299
- // Array.isArray instead of instanceof
300
- "unicorn/no-instanceof-array": "error",
301
- // Prevent deprecated `new Buffer()`
302
- "unicorn/no-new-buffer": "error",
303
- // Keep regex literals safe!
304
- "unicorn/no-unsafe-regex": "off",
305
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
306
- "unicorn/number-literal-case": "error",
307
- // includes over indexOf when checking for existence
308
- "unicorn/prefer-includes": "error",
309
- // String methods startsWith/endsWith instead of more complicated stuff
310
- "unicorn/prefer-string-starts-ends-with": "error",
311
- // textContent instead of innerText
312
- "unicorn/prefer-text-content": "error",
313
- // Enforce throwing type error when throwing error while checking typeof
314
- "unicorn/prefer-type-error": "error",
315
- // Use new when throwing error
316
- "unicorn/throw-new-error": "error",
317
-
318
- "no-use-before-define": [
319
- "error",
320
- { functions: false, classes: false, variables: true }
321
- ],
322
- "eslint-comments/disable-enable-pair": "off",
323
- "import/no-named-as-default-member": "off",
324
- "import/no-named-as-default": "off",
325
- "import/namespace": "off",
326
- "n/no-callback-literal": "off",
327
-
328
- "sort-imports": [
329
- "error",
330
- {
331
- ignoreCase: false,
332
- ignoreDeclarationSort: true,
333
- ignoreMemberSort: false,
334
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
335
- allowSeparatedGroups: false
336
- }
337
- ],
338
- "yml/quotes": ["error", { prefer: "double", avoidEscape: true }],
339
- "yml/no-empty-document": "off",
340
- "padded-blocks": "off",
341
- "no-trailing-spaces": ["error", { skipBlankLines: true }]
342
- }
343
- };
package/react.js DELETED
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- "plugin:react/recommended",
4
- "plugin:react-hooks/recommended",
5
- "./typescript"
6
- ],
7
- settings: {
8
- react: {
9
- version: "17.0"
10
- }
11
- },
12
- rules: {
13
- "jsx-quotes": ["error", "prefer-double"],
14
- "react/react-in-jsx-scope": "off"
15
- }
16
- };
package/typescript.js DELETED
@@ -1,139 +0,0 @@
1
- const basic = require("./basic");
2
-
3
- module.exports = {
4
- extends: [
5
- "./basic",
6
- "plugin:import/typescript",
7
- "plugin:@typescript-eslint/recommended"
8
- ],
9
- settings: {
10
- "import/resolver": {
11
- node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] }
12
- }
13
- },
14
- overrides: basic.overrides,
15
- rules: {
16
- "import/named": "off",
17
- "@typescript-eslint/ban-ts-comment": [
18
- "error",
19
- { "ts-ignore": "allow-with-description" }
20
- ],
21
- "@typescript-eslint/type-annotation-spacing": ["error", {}],
22
- "@typescript-eslint/consistent-type-imports": [
23
- "error",
24
- { prefer: "type-imports", disallowTypeAnnotations: false }
25
- ],
26
- "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
27
- "@typescript-eslint/prefer-ts-expect-error": "error",
28
- "no-useless-constructor": "off",
29
- "indent": "off",
30
- "@typescript-eslint/indent": [
31
- "error",
32
- 2,
33
- {
34
- SwitchCase: 1,
35
- VariableDeclarator: 1,
36
- outerIIFEBody: 1,
37
- MemberExpression: 1,
38
- FunctionDeclaration: { parameters: 1, body: 1 },
39
- FunctionExpression: { parameters: 1, body: 1 },
40
- CallExpression: { arguments: 1 },
41
- ArrayExpression: 1,
42
- ObjectExpression: 1,
43
- ImportDeclaration: 1,
44
- flatTernaryExpressions: false,
45
- ignoreComments: false,
46
- ignoredNodes: [
47
- "TemplateLiteral *",
48
- "JSXElement",
49
- "JSXElement > *",
50
- "JSXAttribute",
51
- "JSXIdentifier",
52
- "JSXNamespacedName",
53
- "JSXMemberExpression",
54
- "JSXSpreadAttribute",
55
- "JSXExpressionContainer",
56
- "JSXOpeningElement",
57
- "JSXClosingElement",
58
- "JSXFragment",
59
- "JSXOpeningFragment",
60
- "JSXClosingFragment",
61
- "JSXText",
62
- "JSXEmptyExpression",
63
- "JSXSpreadChild",
64
- "TSTypeParameterInstantiation",
65
- "FunctionExpression > .params[decorators.length > 0]",
66
- "FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
67
- "ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
68
- ],
69
- offsetTernaryExpressions: true
70
- }
71
- ],
72
- "no-unused-vars": "off",
73
- "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
74
- "no-redeclare": "off",
75
- "@typescript-eslint/no-redeclare": "error",
76
- "no-use-before-define": "off",
77
- "@typescript-eslint/no-use-before-define": [
78
- "error",
79
- { functions: false, classes: false, variables: true }
80
- ],
81
- "comma-dangle": "off",
82
- "@typescript-eslint/comma-dangle": ["error", "never"],
83
- "object-curly-spacing": "off",
84
- "@typescript-eslint/object-curly-spacing": ["error", "always"],
85
- "semi": "off",
86
- "@typescript-eslint/semi": ["warn", "always"],
87
- "quotes": "off",
88
- "@typescript-eslint/quotes": ["error", "double"],
89
- "space-before-blocks": "off",
90
- "@typescript-eslint/space-before-blocks": ["error", "always"],
91
- "space-before-function-paren": "off",
92
- "@typescript-eslint/space-before-function-paren": [
93
- "error",
94
- {
95
- anonymous: "always",
96
- named: "never",
97
- asyncArrow: "always"
98
- }
99
- ],
100
- "space-infix-ops": "off",
101
- "@typescript-eslint/space-infix-ops": "error",
102
- "keyword-spacing": "off",
103
- "@typescript-eslint/keyword-spacing": [
104
- "error",
105
- { before: true, after: true }
106
- ],
107
- "comma-spacing": "off",
108
- "@typescript-eslint/comma-spacing": [
109
- "error",
110
- { before: false, after: true }
111
- ],
112
- "no-extra-parens": "off",
113
- "@typescript-eslint/no-extra-parens": ["error", "functions"],
114
- "no-dupe-class-members": "off",
115
- "@typescript-eslint/no-dupe-class-members": "error",
116
- "no-loss-of-precision": "off",
117
- "@typescript-eslint/no-loss-of-precision": "error",
118
- "lines-between-class-members": "off",
119
- "@typescript-eslint/lines-between-class-members": [
120
- "error",
121
- "always",
122
- { exceptAfterSingleLine: true }
123
- ],
124
- "@typescript-eslint/consistent-indexed-object-style": "off",
125
- "@typescript-eslint/naming-convention": "off",
126
- "@typescript-eslint/explicit-function-return-type": "off",
127
- "@typescript-eslint/explicit-member-accessibility": "off",
128
- "@typescript-eslint/no-explicit-any": "off",
129
- "@typescript-eslint/parameter-properties": "off",
130
- "@typescript-eslint/no-empty-interface": "off",
131
- "@typescript-eslint/ban-ts-ignore": "off",
132
- "@typescript-eslint/no-empty-function": "off",
133
- "@typescript-eslint/no-non-null-assertion": "off",
134
- "@typescript-eslint/explicit-module-boundary-types": "off",
135
- "@typescript-eslint/ban-types": "off",
136
- "@typescript-eslint/no-namespace": "off",
137
- "@typescript-eslint/triple-slash-reference": "off"
138
- }
139
- };