@elementx-ai/eslint-config 7.2.2 → 8.0.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  This repository adheres to semantic versioning and follows the conventions of [keepachangelog.com](http://keepachangelog.com)
4
4
 
5
+ ## [8.0.2](https://github.com/elementx-ai/eslint-config/compare/v8.0.1...v8.0.2) (2025-01-08)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Update README ([#31](https://github.com/elementx-ai/eslint-config/issues/31)) ([ae56e32](https://github.com/elementx-ai/eslint-config/commit/ae56e3278a17b3d3dee531cffbff377f74684978))
11
+
12
+ ## [8.0.1](https://github.com/elementx-ai/eslint-config/compare/v8.0.0...v8.0.1) (2025-01-08)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * Update README ([#29](https://github.com/elementx-ai/eslint-config/issues/29)) ([b356bc7](https://github.com/elementx-ai/eslint-config/commit/b356bc7ed3e5df0f2c59815bf7b2d60ed79a481d))
18
+
19
+ ## [8.0.0](https://github.com/elementx-ai/eslint-config/compare/v7.2.2...v8.0.0) (2025-01-08)
20
+
21
+
22
+ ### ⚠ BREAKING CHANGES
23
+
24
+ * Upgrade eslint-config to use new flat file configuration structure ([#27](https://github.com/elementx-ai/eslint-config/issues/27))
25
+
26
+ ### Features
27
+
28
+ * Upgrade eslint-config to use new flat file configuration structure ([#27](https://github.com/elementx-ai/eslint-config/issues/27)) ([8d27e29](https://github.com/elementx-ai/eslint-config/commit/8d27e29196e4e1d480672d0949334346a64f8a48))
29
+
5
30
  ## [7.2.2](https://github.com/elementx-ai/eslint-config/compare/v7.2.1...v7.2.2) (2025-01-05)
6
31
 
7
32
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ElementX's Eslint Config
2
2
 
3
- This package provides ElementX's .eslintrc.yaml as an extensible [shared config](https://eslint.org/docs/developer-guide/shareable-configs) :sparkles:
3
+ This package provides ElementX's eslint config as an extensible [shared config](https://eslint.org/docs/developer-guide/shareable-configs) :sparkles:
4
4
 
5
5
  ## Install and Setup
6
6
 
@@ -12,11 +12,21 @@ npm i -D eslint @elementx-ai/eslint-config
12
12
 
13
13
  ## Usage
14
14
 
15
- Create a `.eslintrc.yaml` file in the root of the repo you are working on and extend the preset/config you wish to use
15
+ Create a `eslint.config.js` file in the root of the repo you are working on and import the config you wish to use
16
16
 
17
- e.g. using the `typescript` linting rules (additional rules can be added to this `extends` list)
17
+ e.g. using the `ts` linting rules (additional rules can be added to the array)
18
18
 
19
- ```yaml
20
- extends:
21
- - "@elementx-ai/eslint-config/configs/typescript"
19
+ ```js
20
+ // eslint.config.js
21
+ import ts from "@elementx-ai/eslint-config/configs/ts.js";
22
+
23
+ export default [
24
+ ...ts,
25
+ // anything from here will override myconfig
26
+ {
27
+ rules: {
28
+ "no-unused-vars": "warn"
29
+ }
30
+ }
31
+ ];
22
32
  ```
package/configs/js.js ADDED
@@ -0,0 +1,5 @@
1
+ import common from "../lib/common.js";
2
+
3
+ export default [
4
+ ...common,
5
+ ];
package/configs/jsx.js ADDED
@@ -0,0 +1,4 @@
1
+ import common from "../lib/common";
2
+ import react from "../lib/react.js";
3
+
4
+ export default [...common, ...react];
package/configs/ts.js ADDED
@@ -0,0 +1,7 @@
1
+ import common from "../lib/common.js";
2
+ import typescript from "../lib/typescript.js";
3
+
4
+ export default [
5
+ ...common,
6
+ ...typescript,
7
+ ];
package/configs/tsx.js ADDED
@@ -0,0 +1,5 @@
1
+ import common from "../lib/common.js";
2
+ import react from "../lib/react.js";
3
+ import typescript from "../lib/typescript.js";
4
+
5
+ export default [...common, ...typescript, ...react];
@@ -0,0 +1,16 @@
1
+ import importPlugin from "eslint-plugin-import";
2
+
3
+ import config from "./index.js";
4
+
5
+ export default [
6
+ ...config,
7
+ {
8
+ plugins: {
9
+ "import": importPlugin,
10
+ },
11
+ rules: {
12
+ "import/no-default-export": "off",
13
+ "import/prefer-default-export": ["error", { target: "any" }],
14
+ },
15
+ },
16
+ ];
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
- module.exports = {
2
- "extends": [ "./configs/node" ],
3
- };
1
+ import node from "./configs/js.js";
2
+
3
+ export default [
4
+ ...node,
5
+ ];
package/lib/common.js CHANGED
@@ -1,116 +1,127 @@
1
- module.exports = {
2
- extends: ["eslint:recommended"],
3
- env: {
4
- node: true,
5
- es6: true,
6
- mocha: true,
7
- },
8
- plugins: ["prefer-arrow", "import"],
9
- rules: {
10
- complexity: ["error", 10],
11
- eqeqeq: ["error", "smart"],
12
- quotes: ["error", "double", { allowTemplateLiterals: true }],
13
- curly: ["error", "all"],
14
- "linebreak-style": ["error", "unix"],
15
- "brace-style": ["error", "1tbs"],
16
- "eol-last": ["error", "always"],
17
- "space-in-parens": ["error", "never"],
18
- "no-multi-spaces": ["error"],
19
- "no-trailing-spaces": ["error"],
20
- "object-curly-spacing": ["error", "always"],
21
- "array-bracket-spacing": ["error", "never"],
22
- "space-before-blocks": ["error"],
23
- "import/no-default-export": "error",
24
- "arrow-body-style": ["error", "as-needed"],
25
- "no-return-await": ["error"],
26
- "default-case-last": ["error"],
27
- "no-console": "off",
28
- "linebreak-style": "off",
29
- "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
30
- "comma-spacing": ["error", { before: false, after: true }],
31
- "generator-star-spacing": ["error", { before: false, after: true }],
32
- "arrow-spacing": ["error", { before: true, after: true }],
33
- "keyword-spacing": ["error", { before: true, after: true }],
34
- indent: [
35
- "error",
36
- 2,
37
- {
38
- SwitchCase: 1,
39
- },
40
- ],
41
- semi: ["error", "always"],
42
- "prefer-const": [
43
- "error",
44
- {
45
- destructuring: "all",
46
- },
47
- ],
48
- "max-lines": [
49
- "error",
50
- {
51
- max: 600,
52
- skipBlankLines: true,
53
- skipComments: true,
54
- },
55
- ],
56
- "max-len": [
57
- "error",
58
- {
59
- code: 120,
60
- ignoreComments: true,
61
- ignoreTrailingComments: true,
62
- ignoreUrls: true,
63
- ignoreStrings: true,
64
- ignoreTemplateLiterals: true,
65
- ignoreRegExpLiterals: true,
66
- },
67
- ],
68
- "space-before-function-paren": [
69
- "error",
70
- {
71
- anonymous: "never",
72
- named: "never",
73
- asyncArrow: "always",
74
- },
75
- ],
76
- "comma-dangle": [
77
- "error",
78
- {
79
- arrays: "always-multiline",
80
- objects: "always-multiline",
81
- imports: "always-multiline",
82
- exports: "always-multiline",
83
- functions: "never",
84
- },
85
- ],
86
- "prefer-arrow/prefer-arrow-functions": [
87
- "error",
88
- {
89
- disallowPrototype: true,
90
- singleReturnOnly: false,
91
- classPropertiesAllowed: false,
92
- },
93
- ],
94
- "prefer-arrow-callback": [
95
- "error",
96
- {
97
- allowNamedFunctions: true,
98
- },
99
- ],
100
- "func-style": [
101
- "error",
102
- "expression",
103
- {
104
- allowArrowFunctions: true,
105
- },
106
- ],
107
- "import/order": [
108
- "error",
109
- {
110
- "newlines-between": "always",
111
- groups: ["external", "builtin", "internal", "sibling", "parent", "index"],
1
+ import eslint from "@eslint/js";
2
+ import stylistic from "@stylistic/eslint-plugin";
3
+ import _import from "eslint-plugin-import";
4
+ import preferArrow from "eslint-plugin-prefer-arrow";
5
+ import globals from "globals";
6
+
7
+ export default [
8
+ eslint.configs.recommended,
9
+ {
10
+ languageOptions: {
11
+ globals: {
12
+ ...globals.browser,
13
+ ...globals.node,
112
14
  },
113
- ],
114
- "padded-blocks": ["error", "never"],
15
+ },
16
+ plugins: {
17
+ "prefer-arrow": preferArrow,
18
+ "import": _import,
19
+ "@stylistic": stylistic,
20
+ },
21
+ rules: {
22
+ "complexity": ["error", 10],
23
+ "eqeqeq": ["error", "smart"],
24
+ "quotes": ["error", "double", { allowTemplateLiterals: true }],
25
+ "curly": ["error", "all"],
26
+ "brace-style": ["error", "1tbs"],
27
+ "eol-last": ["error", "always"],
28
+ "space-in-parens": ["error", "never"],
29
+ "no-multi-spaces": ["error"],
30
+ "no-trailing-spaces": ["error"],
31
+ "object-curly-spacing": ["error", "always"],
32
+ "array-bracket-spacing": ["error", "never"],
33
+ "space-before-blocks": ["error"],
34
+ "import/no-default-export": "error",
35
+ "arrow-body-style": ["error", "as-needed"],
36
+ "no-return-await": ["error"],
37
+ "default-case-last": ["error"],
38
+ "no-console": "off",
39
+ "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
40
+ "comma-spacing": ["error", { before: false, after: true }],
41
+ "generator-star-spacing": ["error", { before: false, after: true }],
42
+ "arrow-spacing": ["error", { before: true, after: true }],
43
+ "keyword-spacing": ["error", { before: true, after: true }],
44
+ "indent": [
45
+ "error",
46
+ 2,
47
+ {
48
+ SwitchCase: 1,
49
+ },
50
+ ],
51
+ "@stylistic/semi": ["error", "always"],
52
+ "prefer-const": [
53
+ "error",
54
+ {
55
+ destructuring: "all",
56
+ },
57
+ ],
58
+ "max-lines": [
59
+ "error",
60
+ {
61
+ max: 600,
62
+ skipBlankLines: true,
63
+ skipComments: true,
64
+ },
65
+ ],
66
+ "max-len": [
67
+ "error",
68
+ {
69
+ code: 120,
70
+ ignoreComments: true,
71
+ ignoreTrailingComments: true,
72
+ ignoreUrls: true,
73
+ ignoreStrings: true,
74
+ ignoreTemplateLiterals: true,
75
+ ignoreRegExpLiterals: true,
76
+ },
77
+ ],
78
+ "space-before-function-paren": [
79
+ "error",
80
+ {
81
+ anonymous: "never",
82
+ named: "never",
83
+ asyncArrow: "always",
84
+ },
85
+ ],
86
+ "comma-dangle": [
87
+ "error",
88
+ {
89
+ arrays: "always-multiline",
90
+ objects: "always-multiline",
91
+ imports: "always-multiline",
92
+ exports: "always-multiline",
93
+ functions: "never",
94
+ },
95
+ ],
96
+ "prefer-arrow/prefer-arrow-functions": [
97
+ "error",
98
+ {
99
+ disallowPrototype: true,
100
+ singleReturnOnly: false,
101
+ classPropertiesAllowed: false,
102
+ },
103
+ ],
104
+ "prefer-arrow-callback": [
105
+ "error",
106
+ {
107
+ allowNamedFunctions: true,
108
+ },
109
+ ],
110
+ "func-style": [
111
+ "error",
112
+ "expression",
113
+ {
114
+ allowArrowFunctions: true,
115
+ },
116
+ ],
117
+ "import/order": [
118
+ "error",
119
+ {
120
+ "newlines-between": "always",
121
+ groups: ["external", "builtin", "internal", "sibling", "parent", "index"],
122
+ },
123
+ ],
124
+ "padded-blocks": ["error", "never"],
125
+ },
115
126
  },
116
- };
127
+ ];
package/lib/react.js ADDED
@@ -0,0 +1,18 @@
1
+ import reactHooks from "eslint-plugin-react-hooks";
2
+ import reactRefresh from "eslint-plugin-react-refresh";
3
+
4
+ export default [
5
+ {
6
+ plugins: {
7
+ "react-hooks": reactHooks,
8
+ "react-refresh": reactRefresh,
9
+ },
10
+ rules: {
11
+ ...reactHooks.configs.recommended.rules,
12
+ "react-refresh/only-export-components": [
13
+ "warn",
14
+ { allowConstantExport: true },
15
+ ],
16
+ },
17
+ },
18
+ ];
package/lib/typescript.js CHANGED
@@ -1,99 +1,108 @@
1
- module.exports = {
2
- parser: "@typescript-eslint/parser",
3
- parserOptions: {
4
- project: "tsconfig.json",
5
- sourceType: "module",
6
- },
7
- plugins: ["@typescript-eslint"],
8
- rules: {
9
- "@typescript-eslint/prefer-namespace-keyword": ["error"],
10
- "@typescript-eslint/no-unused-vars": ["error"],
11
- "@typescript-eslint/semi": ["error", "always"],
12
- "@typescript-eslint/type-annotation-spacing": ["error"],
13
- "@typescript-eslint/no-undef": "off",
14
- "@typescript-eslint/indent": [
15
- "error",
16
- 2,
17
- {
18
- SwitchCase: 1,
1
+ import stylistic from "@stylistic/eslint-plugin";
2
+ import typescript from "@typescript-eslint/eslint-plugin";
3
+ import parser from "@typescript-eslint/parser";
4
+
5
+ export default [
6
+ {
7
+ languageOptions: {
8
+ parser: parser,
9
+ parserOptions: {
10
+ projectService: true,
19
11
  },
20
- ],
21
- "@typescript-eslint/member-delimiter-style": [
22
- "error",
23
- {
24
- multiline: {
25
- delimiter: "semi",
26
- requireLast: true,
12
+ },
13
+ plugins: {
14
+ "@stylistic": stylistic,
15
+ "@typescript-eslint": typescript,
16
+ },
17
+ rules: {
18
+ "@stylistic/type-annotation-spacing": ["error"],
19
+ "@stylistic/indent": [
20
+ "error",
21
+ 2,
22
+ {
23
+ SwitchCase: 1,
27
24
  },
28
- singleline: {
29
- delimiter: "semi",
30
- requireLast: false,
25
+ ],
26
+ "@stylistic/member-delimiter-style": [
27
+ "error",
28
+ {
29
+ multiline: {
30
+ delimiter: "semi",
31
+ requireLast: true,
32
+ },
33
+ singleline: {
34
+ delimiter: "semi",
35
+ requireLast: false,
36
+ },
31
37
  },
32
- },
33
- ],
34
- "@typescript-eslint/naming-convention": [
35
- "error",
36
- {
37
- selector: ["default"],
38
- format: ["camelCase"],
39
- leadingUnderscore: "allow",
40
- },
41
- {
42
- selector: "import",
43
- format: ["camelCase", "PascalCase"],
44
- },
45
- {
46
- selector: ["typeLike", "enumMember"],
47
- format: ["PascalCase"],
48
- },
49
- {
50
- selector: ["parameter"],
51
- modifiers: ["destructured"],
52
- format: null,
53
- },
54
- {
55
- selector: ["property", "objectLiteralProperty"],
56
- format: null,
57
- },
58
- {
59
- selector: [
60
- "classProperty",
61
- "objectLiteralProperty",
62
- "typeProperty",
63
- "classMethod",
64
- "objectLiteralMethod",
65
- "typeMethod",
66
- "accessor",
67
- "enumMember",
68
- ],
69
- modifiers: ["requiresQuotes"],
70
- format: null,
71
- },
72
- {
73
- selector: ["variable"],
74
- modifiers: ["const"],
75
- types: ["function"],
76
- format: ["camelCase", "PascalCase"],
77
- leadingUnderscore: "allow",
78
- },
79
- {
80
- selector: ["variable"],
81
- modifiers: ["destructured"],
82
- format: null,
83
- },
84
- {
85
- selector: ["variable"],
86
- modifiers: ["const"],
87
- types: ["boolean", "string", "number", "array"],
88
- format: ["camelCase", "UPPER_CASE"],
89
- leadingUnderscore: "allow",
90
- },
91
- {
92
- selector: ["memberLike"],
93
- modifiers: ["private"],
94
- format: ["camelCase"],
95
- leadingUnderscore: "require",
96
- },
97
- ],
38
+ ],
39
+ "@typescript-eslint/prefer-namespace-keyword": ["error"],
40
+ "@typescript-eslint/no-unused-vars": ["error"],
41
+ "@typescript-eslint/no-undef": "off",
42
+ "@typescript-eslint/naming-convention": [
43
+ "error",
44
+ {
45
+ selector: ["default"],
46
+ format: ["camelCase"],
47
+ leadingUnderscore: "allow",
48
+ },
49
+ {
50
+ selector: "import",
51
+ format: ["camelCase", "PascalCase"],
52
+ },
53
+ {
54
+ selector: ["typeLike", "enumMember"],
55
+ format: ["PascalCase"],
56
+ },
57
+ {
58
+ selector: ["parameter"],
59
+ modifiers: ["destructured"],
60
+ format: null,
61
+ },
62
+ {
63
+ selector: ["property", "objectLiteralProperty"],
64
+ format: null,
65
+ },
66
+ {
67
+ selector: [
68
+ "classProperty",
69
+ "objectLiteralProperty",
70
+ "typeProperty",
71
+ "classMethod",
72
+ "objectLiteralMethod",
73
+ "typeMethod",
74
+ "accessor",
75
+ "enumMember",
76
+ ],
77
+ modifiers: ["requiresQuotes"],
78
+ format: null,
79
+ },
80
+ {
81
+ selector: ["variable"],
82
+ modifiers: ["const"],
83
+ types: ["function"],
84
+ format: ["camelCase", "PascalCase"],
85
+ leadingUnderscore: "allow",
86
+ },
87
+ {
88
+ selector: ["variable"],
89
+ modifiers: ["destructured"],
90
+ format: null,
91
+ },
92
+ {
93
+ selector: ["variable"],
94
+ modifiers: ["const"],
95
+ types: ["boolean", "string", "number", "array"],
96
+ format: ["camelCase", "UPPER_CASE"],
97
+ leadingUnderscore: "allow",
98
+ },
99
+ {
100
+ selector: ["memberLike"],
101
+ modifiers: ["private"],
102
+ format: ["camelCase"],
103
+ leadingUnderscore: "require",
104
+ },
105
+ ],
106
+ },
98
107
  },
99
- };
108
+ ];
package/package.json CHANGED
@@ -1,27 +1,35 @@
1
1
  {
2
2
  "name": "@elementx-ai/eslint-config",
3
- "version": "7.2.2",
3
+ "version": "8.0.2",
4
4
  "description": "ElementX's ESLint Config",
5
5
  "license": "Unlicense",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/spark-64/eslint-config"
8
+ "url": "https://github.com/elementx-ai/eslint-config"
9
9
  },
10
10
  "bugs": {
11
- "url": "https://github.com/spark-64/eslint-config/issues"
11
+ "url": "https://github.com/elementx-ai/eslint-config/issues"
12
12
  },
13
13
  "keywords": [
14
14
  "eslint",
15
- "eslintconfig"
15
+ "eslintconfig",
16
+ "eslint-config"
16
17
  ],
17
18
  "main": "index.js",
19
+ "type": "module",
18
20
  "dependencies": {
21
+ "@stylistic/eslint-plugin": "^2.12.1",
22
+ "@typescript-eslint/eslint-plugin": "^8.19.1",
23
+ "@typescript-eslint/parser": "^8.19.1",
19
24
  "eslint-plugin-import": "^2.31.0",
20
- "eslint-plugin-prefer-arrow": "^1.2.3"
25
+ "eslint-plugin-prefer-arrow": "^1.2.3",
26
+ "eslint-plugin-react-hooks": "^5.1.0",
27
+ "eslint-plugin-react-refresh": "^0.4.16"
21
28
  },
22
29
  "peerDependencies": {
23
- "eslint": "^8.57.1",
24
- "@typescript-eslint/eslint-plugin": "^8.19.0",
25
- "@typescript-eslint/parser": "^8.19.0"
30
+ "eslint": "^9.17.0"
31
+ },
32
+ "devDependencies": {
33
+ "eslint": "^9.17.0"
26
34
  }
27
35
  }
package/configs/node.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- "../lib/common.js",
4
- ],
5
- };
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- "../lib/common.js",
4
- "../lib/typescript",
5
- ],
6
- };