@smartive/eslint-config 6.3.2 → 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 +6 -4
- package/dist/cjs/index.js +16 -3
- package/dist/esm/index.js +16 -3
- package/dist/index.d.ts +4 -0
- package/package.json +1 -2
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 {
|
|
18
|
+
import { config } from '@smartive/eslint-config'
|
|
19
19
|
|
|
20
20
|
// For plain TS applications ..
|
|
21
|
-
export default
|
|
21
|
+
export default config('typescript');
|
|
22
22
|
|
|
23
23
|
// .. or React applications
|
|
24
|
-
export default
|
|
24
|
+
export default config('react');
|
|
25
25
|
|
|
26
26
|
// .. or Next.js applications
|
|
27
|
-
|
|
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((
|
|
119
|
-
const { plugins } =
|
|
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
|
|
124
|
+
return config2;
|
|
124
125
|
});
|
|
125
126
|
const flatConfigReact = (includeNextJsConfig = false) => import_typescript_eslint.default.config(
|
|
126
127
|
flatConfigTypescript,
|
|
@@ -133,6 +134,18 @@ const configs = {
|
|
|
133
134
|
typescript: flatConfigTypescript,
|
|
134
135
|
react: flatConfigReact()
|
|
135
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
|
+
}
|
|
148
|
+
};
|
|
136
149
|
const generateLegacyConfig = (react) => ({
|
|
137
150
|
rules: rules(react),
|
|
138
151
|
env: {
|
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((
|
|
85
|
-
const { plugins } =
|
|
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
|
|
89
|
+
return config2;
|
|
90
90
|
});
|
|
91
91
|
const flatConfigReact = (includeNextJsConfig = false) => tsEslint.config(
|
|
92
92
|
flatConfigTypescript,
|
|
@@ -99,6 +99,18 @@ const configs = {
|
|
|
99
99
|
typescript: flatConfigTypescript,
|
|
100
100
|
react: flatConfigReact()
|
|
101
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
|
+
}
|
|
113
|
+
};
|
|
102
114
|
const generateLegacyConfig = (react) => ({
|
|
103
115
|
rules: rules(react),
|
|
104
116
|
env: {
|
|
@@ -135,6 +147,7 @@ const generateLegacyConfig = (react) => ({
|
|
|
135
147
|
]
|
|
136
148
|
});
|
|
137
149
|
export {
|
|
150
|
+
config,
|
|
138
151
|
configs,
|
|
139
152
|
generateLegacyConfig
|
|
140
153
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +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
8
|
};
|
|
9
|
+
export declare const config: (type: string) => import("@typescript-eslint/utils/dist/ts-eslint").FlatConfig.ConfigArray;
|
|
6
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
|
+
"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"
|