@castiron/eslint-config 2.0.0 → 2.1.0-alpha.6

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
@@ -1,11 +1,19 @@
1
- # eslint-config-cic
1
+ # @castiron/eslint-config
2
2
 
3
- An ESLint [Shareable Config](http://eslint.org/docs/developer-guide/shareable-configs) for CIC projects
3
+ An ESLint [Shareable Config](http://eslint.org/docs/developer-guide/shareable-configs) for CIC projects.
4
+
5
+ For React projects, use [`@castiron/eslint-config-react`](../eslint-config-react) instead.
4
6
 
5
7
  ## 💿 Installation
6
8
 
7
9
  ```bash
8
- yarn add @castiron/eslint-config -D
10
+ yarn add -D @castiron/eslint-config eslint
11
+ ```
12
+
13
+ The TypeScript config (and the default export, which includes it) needs TypeScript and its plugins installed alongside:
14
+
15
+ ```bash
16
+ yarn add -D typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin
9
17
  ```
10
18
 
11
19
  ## 📖 Usage
@@ -21,12 +29,13 @@ import cicConfig from "@castiron/eslint-config";
21
29
  export default [...cicConfig];
22
30
  ```
23
31
 
24
- If you'd like to use only some of the rules, each config has a named export:
32
+ If you'd like to use only some of the rules, import each config from its own entry point (`/base`, `/js`, `/ts`) so plugins for unused configs are never loaded:
25
33
 
26
34
  ```js
27
35
  // Example: Vanilla js project with babel parser.
28
36
  // eslint.config.js
29
- import { baseConfig, jsConfig } from "@castiron/eslint-config";
37
+ import baseConfig from "@castiron/eslint-config/base";
38
+ import jsConfig from "@castiron/eslint-config/js";
30
39
 
31
40
  export default [
32
41
  {
@@ -50,7 +59,9 @@ export default [
50
59
  ```js
51
60
  // Example: Astro project without react.
52
61
  // eslint.config.js
53
- import { baseConfig, jsConfig, tsConfig } from "@castiron/eslint-config";
62
+ import baseConfig from "@castiron/eslint-config/base";
63
+ import jsConfig from "@castiron/eslint-config/js";
64
+ import tsConfig from "@castiron/eslint-config/ts";
54
65
  import eslintPluginAstro from "eslint-plugin-astro";
55
66
 
56
67
  export default [
package/configs/base.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import eslintPluginRegexp from "eslint-plugin-regexp";
1
2
  import unusedImports from "eslint-plugin-unused-imports";
2
3
  import globals from "globals";
3
4
 
@@ -9,6 +10,7 @@ const baseConfig = {
9
10
  }
10
11
  },
11
12
  rules: {
13
+ ...eslintPluginRegexp.configs["flat/recommended"].rules,
12
14
  "array-callback-return": 0,
13
15
  "arrow-body-style": 0,
14
16
  "global-require": 0,
@@ -54,6 +56,7 @@ const baseConfig = {
54
56
  },
55
57
  plugins: {
56
58
  "unused-imports": unusedImports,
59
+ regexp: eslintPluginRegexp,
57
60
  }
58
61
  };
59
62
 
package/index.mjs CHANGED
@@ -1,15 +1,13 @@
1
1
  import baseConfig from "./configs/base.mjs";
2
2
  import jsConfig from "./configs/js.mjs";
3
3
  import tsConfig from "./configs/ts.mjs";
4
- import reactConfig from "./configs/react.mjs";
5
4
 
6
- // Export one big config (React/TS projects)
5
+ // Export one big config (TS projects)
7
6
  export default [
8
7
  baseConfig,
9
8
  jsConfig,
10
- tsConfig,
11
- reactConfig
9
+ tsConfig
12
10
  ];
13
11
 
14
12
  // Export configs separately for finer control over linting rules
15
- export { baseConfig, jsConfig, tsConfig, reactConfig };
13
+ export { baseConfig, jsConfig, tsConfig };
package/package.json CHANGED
@@ -1,8 +1,15 @@
1
1
  {
2
2
  "name": "@castiron/eslint-config",
3
- "version": "2.0.0",
3
+ "version": "2.1.0-alpha.6",
4
4
  "description": "General eslint configuration for Cast Iron Coding projects",
5
5
  "main": "index.mjs",
6
+ "exports": {
7
+ ".": "./index.mjs",
8
+ "./base": "./configs/base.mjs",
9
+ "./js": "./configs/js.mjs",
10
+ "./ts": "./configs/ts.mjs",
11
+ "./package.json": "./package.json"
12
+ },
6
13
  "files": [
7
14
  "index.mjs",
8
15
  "configs",
@@ -10,44 +17,48 @@
10
17
  ],
11
18
  "repository": {
12
19
  "type": "git",
13
- "url": "git+https://github.com/castiron/eslint-config-cic.git"
20
+ "url": "git+https://github.com/castiron/eslint-config-cic.git",
21
+ "directory": "packages/eslint-config"
14
22
  },
15
23
  "author": "Cast Iron Coding",
16
24
  "license": "MIT",
17
25
  "bugs": {
18
26
  "url": "https://github.com/castiron/eslint-config-cic/issues"
19
27
  },
20
- "homepage": "https://github.com/castiron/eslint-config-cic#readme",
28
+ "homepage": "https://github.com/castiron/eslint-config-cic/tree/main/packages/eslint-config#readme",
21
29
  "engines": {
22
30
  "node": ">=24.x"
23
31
  },
24
32
  "scripts": {
25
- "npm:publish": "yarn npm publish --access public",
26
- "lint": "eslint . --config index.mjs",
27
- "fix": "eslint . --fix"
33
+ "npm:publish": "yarn npm publish --access public"
28
34
  },
29
- "devDependencies": {
35
+ "dependencies": {
30
36
  "@eslint/js": "^10.0.1",
37
+ "eslint-plugin-regexp": "^3.3.1",
38
+ "eslint-plugin-unused-imports": "^4.4.1",
39
+ "globals": "^17.12.0"
40
+ },
41
+ "devDependencies": {
31
42
  "@typescript-eslint/eslint-plugin": "^8.70.1",
32
43
  "@typescript-eslint/parser": "^8.70.1",
33
44
  "eslint": "^10.11.0",
34
- "eslint-plugin-jsx-a11y": "^6.10.2",
35
- "eslint-plugin-react": "^7.37.5",
36
- "eslint-plugin-react-hooks": "^7.1.1",
37
- "eslint-plugin-unused-imports": "^4.4.1",
38
- "globals": "^17.12.0",
39
45
  "typescript": "^6.0.3"
40
46
  },
41
47
  "peerDependencies": {
42
- "@eslint/js": ">= 10",
43
48
  "@typescript-eslint/eslint-plugin": ">= 8",
44
49
  "@typescript-eslint/parser": ">= 8",
45
50
  "eslint": ">= 10",
46
- "eslint-plugin-jsx-a11y": ">= 6",
47
- "eslint-plugin-react": ">= 7",
48
- "eslint-plugin-react-hooks": ">= 7",
49
- "eslint-plugin-unused-imports": ">= 4",
50
51
  "typescript": ">= 6"
51
52
  },
52
- "packageManager": "yarn@4.14.1"
53
+ "peerDependenciesMeta": {
54
+ "@typescript-eslint/eslint-plugin": {
55
+ "optional": true
56
+ },
57
+ "@typescript-eslint/parser": {
58
+ "optional": true
59
+ },
60
+ "typescript": {
61
+ "optional": true
62
+ }
63
+ }
53
64
  }
package/configs/react.mjs DELETED
@@ -1,25 +0,0 @@
1
- import reactHooks from "eslint-plugin-react-hooks";
2
- import jsxA11y from "eslint-plugin-jsx-a11y";
3
-
4
- const reactConfig = {
5
- files: ["**/*.{jsx,tsx}"],
6
- rules: {
7
- ...reactHooks.configs.recommended.rules,
8
- ...jsxA11y.configs.recommended.rules,
9
- // React rules
10
- "react-hooks/rules-of-hooks": ["warn"],
11
- "react/react-in-jsx-scope": ["off"],
12
- "react/display-name": ["off"],
13
- },
14
- plugins: {
15
- "jsx-a11y": jsxA11y,
16
- "react-hooks": reactHooks,
17
- },
18
- settings: {
19
- react: {
20
- version: "detect",
21
- },
22
- }
23
- };
24
-
25
- export default reactConfig;