@smartive/eslint-config 6.3.1 → 6.4.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
@@ -15,16 +15,18 @@ This package offers two different rule sets, one for plain TypeScript applicatio
15
15
  ### Flat Config (`eslint.config.mjs`)
16
16
 
17
17
  ```javascript
18
- import { configs } from '@smartive/eslint-config'
18
+ import { config } from '@smartive/eslint-config'
19
19
 
20
20
  // For plain TS applications ..
21
- export default configs.typescript;
21
+ export default config('typescript');
22
22
 
23
23
  // .. or React applications
24
- export default configs.react;
24
+ export default config('react');
25
25
 
26
26
  // .. or Next.js applications
27
- export default configs.nextjs;
27
+ // make sure to add `eslint-config-next`
28
+ // to your devDependencies
29
+ export default config('nextjs');
28
30
  ```
29
31
 
30
32
  ### Legacy Config (`.eslintrc`)
package/dist/cjs/index.js CHANGED
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var src_exports = {};
30
30
  __export(src_exports, {
31
+ config: () => config,
31
32
  configs: () => configs,
32
33
  generateLegacyConfig: () => generateLegacyConfig
33
34
  });
@@ -115,12 +116,12 @@ const flatConfigTypescript = import_typescript_eslint.default.config(
115
116
  }
116
117
  }
117
118
  );
118
- const flatConfigNext = () => new import_eslintrc.FlatCompat().extends("next").map((config) => {
119
- const { plugins } = config;
119
+ const flatConfigNext = () => new import_eslintrc.FlatCompat().extends("next").map((config2) => {
120
+ const { plugins } = config2;
120
121
  if (plugins?.import) {
121
122
  plugins.import = import_eslint_plugin_import.flatConfigs.errors.plugins.import;
122
123
  }
123
- return config;
124
+ return config2;
124
125
  });
125
126
  const flatConfigReact = (includeNextJsConfig = false) => import_typescript_eslint.default.config(
126
127
  flatConfigTypescript,
@@ -131,8 +132,19 @@ const flatConfigReact = (includeNextJsConfig = false) => import_typescript_eslin
131
132
  );
132
133
  const configs = {
133
134
  typescript: flatConfigTypescript,
134
- react: flatConfigReact(),
135
- nextjs: flatConfigReact(true)
135
+ react: flatConfigReact()
136
+ };
137
+ const config = (type) => {
138
+ switch (type) {
139
+ case "typescript":
140
+ return flatConfigTypescript;
141
+ case "react":
142
+ return flatConfigReact();
143
+ case "nextjs":
144
+ return flatConfigReact(true);
145
+ default:
146
+ throw new Error(`Unknown config type: ${type}`);
147
+ }
136
148
  };
137
149
  const generateLegacyConfig = (react) => ({
138
150
  rules: rules(react),
package/dist/esm/index.js CHANGED
@@ -81,12 +81,12 @@ const flatConfigTypescript = tsEslint.config(
81
81
  }
82
82
  }
83
83
  );
84
- const flatConfigNext = () => new FlatCompat().extends("next").map((config) => {
85
- const { plugins } = config;
84
+ const flatConfigNext = () => new FlatCompat().extends("next").map((config2) => {
85
+ const { plugins } = config2;
86
86
  if (plugins?.import) {
87
87
  plugins.import = eslintPluginImportConfigs.errors.plugins.import;
88
88
  }
89
- return config;
89
+ return config2;
90
90
  });
91
91
  const flatConfigReact = (includeNextJsConfig = false) => tsEslint.config(
92
92
  flatConfigTypescript,
@@ -97,8 +97,19 @@ const flatConfigReact = (includeNextJsConfig = false) => tsEslint.config(
97
97
  );
98
98
  const configs = {
99
99
  typescript: flatConfigTypescript,
100
- react: flatConfigReact(),
101
- nextjs: flatConfigReact(true)
100
+ react: flatConfigReact()
101
+ };
102
+ const config = (type) => {
103
+ switch (type) {
104
+ case "typescript":
105
+ return flatConfigTypescript;
106
+ case "react":
107
+ return flatConfigReact();
108
+ case "nextjs":
109
+ return flatConfigReact(true);
110
+ default:
111
+ throw new Error(`Unknown config type: ${type}`);
112
+ }
102
113
  };
103
114
  const generateLegacyConfig = (react) => ({
104
115
  rules: rules(react),
@@ -136,6 +147,7 @@ const generateLegacyConfig = (react) => ({
136
147
  ]
137
148
  });
138
149
  export {
150
+ config,
139
151
  configs,
140
152
  generateLegacyConfig
141
153
  };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import type { Linter } from 'eslint';
2
+ /**
3
+ * @deprecated Use `config(type)` instead
4
+ */
2
5
  export declare const configs: {
3
6
  typescript: import("@typescript-eslint/utils/dist/ts-eslint").FlatConfig.ConfigArray;
4
7
  react: import("@typescript-eslint/utils/dist/ts-eslint").FlatConfig.ConfigArray;
5
- nextjs: import("@typescript-eslint/utils/dist/ts-eslint").FlatConfig.ConfigArray;
6
8
  };
9
+ export declare const config: (type: string) => import("@typescript-eslint/utils/dist/ts-eslint").FlatConfig.ConfigArray;
7
10
  export declare const generateLegacyConfig: (react: boolean) => Linter.LegacyConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartive/eslint-config",
3
- "version": "6.3.1",
3
+ "version": "6.4.0",
4
4
  "description": "ESLint configuration by smartive",
5
5
  "files": [
6
6
  "README.md",
@@ -64,7 +64,6 @@
64
64
  "cz-conventional-changelog": "^3.3.0",
65
65
  "esbuild": "0.24.0",
66
66
  "eslint": "^9.15.0",
67
- "eslint-config-next": "^15.0.4",
68
67
  "husky": "^9.1.7",
69
68
  "prettier": "^3.3.3",
70
69
  "typescript": "^5.6.3"