eslint-config-instant 2.4.0 → 2.6.0-next.5

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.
@@ -0,0 +1,7 @@
1
+ import { I as InstantConfig, F as FlatConfigArray } from '../types-Ce23S_AX.js';
2
+ import 'eslint';
3
+
4
+ declare function createReactConfig(options?: InstantConfig): FlatConfigArray;
5
+ declare const reactConfig: FlatConfigArray;
6
+
7
+ export { createReactConfig, reactConfig };
@@ -0,0 +1,82 @@
1
+ // src/configs/react.ts
2
+ import jsxA11y from "eslint-plugin-jsx-a11y";
3
+ import reactPlugin from "eslint-plugin-react";
4
+ import reactHooks from "eslint-plugin-react-hooks";
5
+ import globals from "globals";
6
+ function createReactConfig(options = {}) {
7
+ const { features = {} } = options;
8
+ const enableA11y = features.a11y !== false;
9
+ const configs = [
10
+ // React plugin recommended config
11
+ {
12
+ files: ["**/*.{jsx,tsx}"],
13
+ plugins: {
14
+ react: reactPlugin
15
+ },
16
+ languageOptions: {
17
+ parserOptions: {
18
+ ecmaFeatures: {
19
+ jsx: true
20
+ }
21
+ },
22
+ globals: {
23
+ ...globals.browser
24
+ }
25
+ },
26
+ settings: {
27
+ react: {
28
+ version: "detect"
29
+ }
30
+ },
31
+ rules: {
32
+ ...reactPlugin.configs.recommended.rules,
33
+ ...reactPlugin.configs["jsx-runtime"].rules
34
+ }
35
+ },
36
+ // React Hooks plugin
37
+ {
38
+ files: ["**/*.{js,jsx,ts,tsx}"],
39
+ plugins: {
40
+ "react-hooks": reactHooks
41
+ },
42
+ rules: {
43
+ ...reactHooks.configs.recommended.rules,
44
+ "react-hooks/exhaustive-deps": "warn"
45
+ }
46
+ },
47
+ // React-specific rule overrides
48
+ {
49
+ files: ["**/*.{jsx,tsx}"],
50
+ rules: {
51
+ "react/prop-types": "off",
52
+ // TypeScript handles this
53
+ "react/react-in-jsx-scope": "off",
54
+ // Not needed with React 17+ JSX transform
55
+ "react/jsx-no-target-blank": "error",
56
+ "react/jsx-no-duplicate-props": "error",
57
+ "react/jsx-pascal-case": ["error", { allowAllCaps: true }],
58
+ "react/no-danger-with-children": "error",
59
+ "react/no-deprecated": "warn",
60
+ "react/no-direct-mutation-state": "error",
61
+ "react/self-closing-comp": "error"
62
+ }
63
+ }
64
+ ];
65
+ if (enableA11y) {
66
+ configs.push({
67
+ files: ["**/*.{jsx,tsx}"],
68
+ ...jsxA11y.flatConfigs.recommended,
69
+ rules: {
70
+ ...jsxA11y.flatConfigs.recommended.rules,
71
+ "jsx-a11y/anchor-is-valid": "warn"
72
+ }
73
+ });
74
+ }
75
+ return configs;
76
+ }
77
+ var reactConfig = createReactConfig();
78
+ export {
79
+ createReactConfig,
80
+ reactConfig
81
+ };
82
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/configs/react.ts"],"sourcesContent":["// @ts-expect-error - no types available\nimport jsxA11y from 'eslint-plugin-jsx-a11y';\nimport reactPlugin from 'eslint-plugin-react';\nimport reactHooks from 'eslint-plugin-react-hooks';\nimport globals from 'globals';\n\nimport type { InstantConfig, FlatConfigArray } from '../types.js';\n\nexport function createReactConfig(options: InstantConfig = {}): FlatConfigArray {\n const { features = {} } = options;\n const enableA11y = features.a11y !== false; // Default true for React\n\n const configs: FlatConfigArray = [\n // React plugin recommended config\n {\n files: ['**/*.{jsx,tsx}'],\n plugins: {\n react: reactPlugin,\n },\n languageOptions: {\n parserOptions: {\n ecmaFeatures: {\n jsx: true,\n },\n },\n globals: {\n ...globals.browser,\n },\n },\n settings: {\n react: {\n version: 'detect',\n },\n },\n rules: {\n ...reactPlugin.configs.recommended.rules,\n ...reactPlugin.configs['jsx-runtime'].rules,\n },\n },\n\n // React Hooks plugin\n {\n files: ['**/*.{js,jsx,ts,tsx}'],\n plugins: {\n 'react-hooks': reactHooks,\n },\n rules: {\n ...reactHooks.configs.recommended.rules,\n 'react-hooks/exhaustive-deps': 'warn',\n },\n },\n\n // React-specific rule overrides\n {\n files: ['**/*.{jsx,tsx}'],\n rules: {\n 'react/prop-types': 'off', // TypeScript handles this\n 'react/react-in-jsx-scope': 'off', // Not needed with React 17+ JSX transform\n 'react/jsx-no-target-blank': 'error',\n 'react/jsx-no-duplicate-props': 'error',\n 'react/jsx-pascal-case': ['error', { allowAllCaps: true }],\n 'react/no-danger-with-children': 'error',\n 'react/no-deprecated': 'warn',\n 'react/no-direct-mutation-state': 'error',\n 'react/self-closing-comp': 'error',\n },\n },\n ];\n\n // Add accessibility rules if enabled\n if (enableA11y) {\n configs.push({\n files: ['**/*.{jsx,tsx}'],\n ...jsxA11y.flatConfigs.recommended,\n rules: {\n ...jsxA11y.flatConfigs.recommended.rules,\n 'jsx-a11y/anchor-is-valid': 'warn',\n },\n });\n }\n\n return configs;\n}\n\nexport const reactConfig = createReactConfig();\n"],"mappings":";AACA,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,OAAO,gBAAgB;AACvB,OAAO,aAAa;AAIb,SAAS,kBAAkB,UAAyB,CAAC,GAAoB;AAC9E,QAAM,EAAE,WAAW,CAAC,EAAE,IAAI;AAC1B,QAAM,aAAa,SAAS,SAAS;AAErC,QAAM,UAA2B;AAAA;AAAA,IAE/B;AAAA,MACE,OAAO,CAAC,gBAAgB;AAAA,MACxB,SAAS;AAAA,QACP,OAAO;AAAA,MACT;AAAA,MACA,iBAAiB;AAAA,QACf,eAAe;AAAA,UACb,cAAc;AAAA,YACZ,KAAK;AAAA,UACP;AAAA,QACF;AAAA,QACA,SAAS;AAAA,UACP,GAAG,QAAQ;AAAA,QACb;AAAA,MACF;AAAA,MACA,UAAU;AAAA,QACR,OAAO;AAAA,UACL,SAAS;AAAA,QACX;AAAA,MACF;AAAA,MACA,OAAO;AAAA,QACL,GAAG,YAAY,QAAQ,YAAY;AAAA,QACnC,GAAG,YAAY,QAAQ,aAAa,EAAE;AAAA,MACxC;AAAA,IACF;AAAA;AAAA,IAGA;AAAA,MACE,OAAO,CAAC,sBAAsB;AAAA,MAC9B,SAAS;AAAA,QACP,eAAe;AAAA,MACjB;AAAA,MACA,OAAO;AAAA,QACL,GAAG,WAAW,QAAQ,YAAY;AAAA,QAClC,+BAA+B;AAAA,MACjC;AAAA,IACF;AAAA;AAAA,IAGA;AAAA,MACE,OAAO,CAAC,gBAAgB;AAAA,MACxB,OAAO;AAAA,QACL,oBAAoB;AAAA;AAAA,QACpB,4BAA4B;AAAA;AAAA,QAC5B,6BAA6B;AAAA,QAC7B,gCAAgC;AAAA,QAChC,yBAAyB,CAAC,SAAS,EAAE,cAAc,KAAK,CAAC;AAAA,QACzD,iCAAiC;AAAA,QACjC,uBAAuB;AAAA,QACvB,kCAAkC;AAAA,QAClC,2BAA2B;AAAA,MAC7B;AAAA,IACF;AAAA,EACF;AAGA,MAAI,YAAY;AACd,YAAQ,KAAK;AAAA,MACX,OAAO,CAAC,gBAAgB;AAAA,MACxB,GAAG,QAAQ,YAAY;AAAA,MACvB,OAAO;AAAA,QACL,GAAG,QAAQ,YAAY,YAAY;AAAA,QACnC,4BAA4B;AAAA,MAC9B;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAEO,IAAM,cAAc,kBAAkB;","names":[]}
@@ -0,0 +1,28 @@
1
+ import { I as InstantConfig, F as FlatConfigArray } from './types-Ce23S_AX.js';
2
+ export { a as FlatConfig, b as InstantConfigFeatures, P as PrettierOptions } from './types-Ce23S_AX.js';
3
+ export { prettierConfig } from './prettier.js';
4
+ export { base, createBaseConfig } from './configs/base.js';
5
+ export { createReactConfig, reactConfig } from './configs/react.js';
6
+ export { backend, createBackendConfig } from './configs/backend.js';
7
+ import 'eslint';
8
+
9
+ /**
10
+ * Creates an ESLint flat config for Instant Commerce projects.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * // eslint.config.ts
15
+ * import { instant } from 'eslint-config-instant';
16
+ *
17
+ * export default instant({
18
+ * type: 'react',
19
+ * features: {
20
+ * a11y: true,
21
+ * vitest: true,
22
+ * },
23
+ * });
24
+ * ```
25
+ */
26
+ declare function instant(options?: InstantConfig): FlatConfigArray;
27
+
28
+ export { FlatConfigArray, InstantConfig, instant as default, instant };
package/dist/index.js ADDED
@@ -0,0 +1,273 @@
1
+ // src/configs/backend.ts
2
+ import nodePlugin from "eslint-plugin-n";
3
+ import globals from "globals";
4
+ function createBackendConfig() {
5
+ return [
6
+ // Node.js plugin recommended config
7
+ nodePlugin.configs["flat/recommended"],
8
+ // Node.js environment and rules
9
+ {
10
+ languageOptions: {
11
+ globals: {
12
+ ...globals.node
13
+ }
14
+ },
15
+ rules: {
16
+ // Console logging rules for backend
17
+ "no-console": ["error", { allow: ["warn", "error", "info"] }],
18
+ // Node.js specific rules
19
+ "n/no-unsupported-features/node-builtins": "error",
20
+ "n/no-unsupported-features/es-syntax": "off",
21
+ // TypeScript handles this
22
+ "n/no-missing-import": "off",
23
+ // TypeScript handles this
24
+ "n/no-unpublished-import": "off",
25
+ // Often triggers false positives
26
+ // Prefer modern patterns
27
+ "n/prefer-promises/fs": "error",
28
+ "n/prefer-promises/dns": "error"
29
+ }
30
+ },
31
+ // Disable browser globals for backend
32
+ {
33
+ languageOptions: {
34
+ globals: {
35
+ window: "off",
36
+ document: "off"
37
+ }
38
+ }
39
+ }
40
+ ];
41
+ }
42
+ var backend = createBackendConfig();
43
+
44
+ // src/configs/base.ts
45
+ import eslint from "@eslint/js";
46
+ import prettierConfig from "eslint-config-prettier";
47
+ import importX from "eslint-plugin-import-x";
48
+ import globals2 from "globals";
49
+ import tseslint from "typescript-eslint";
50
+ function createBaseConfig(options = {}) {
51
+ const { tsconfig = "./tsconfig.json", aliases } = options;
52
+ return tseslint.config(
53
+ // Recommended ESLint rules
54
+ eslint.configs.recommended,
55
+ ...tseslint.configs.recommended,
56
+ // Import plugin configuration
57
+ {
58
+ plugins: {
59
+ "import-x": importX
60
+ },
61
+ settings: {
62
+ "import-x/resolver": {
63
+ typescript: {
64
+ alwaysTryTypes: true,
65
+ project: tsconfig
66
+ },
67
+ ...aliases && {
68
+ alias: {
69
+ map: Object.entries(aliases),
70
+ extensions: [".js", ".jsx", ".ts", ".tsx"]
71
+ }
72
+ }
73
+ }
74
+ },
75
+ rules: {
76
+ // Import ordering
77
+ "import-x/order": [
78
+ "error",
79
+ {
80
+ groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
81
+ "newlines-between": "always",
82
+ alphabetize: { order: "asc", caseInsensitive: true }
83
+ }
84
+ ],
85
+ "import-x/no-duplicates": "error",
86
+ "import-x/no-unresolved": "error",
87
+ "import-x/first": "error"
88
+ }
89
+ },
90
+ // TypeScript-specific rules
91
+ {
92
+ rules: {
93
+ "@typescript-eslint/consistent-type-imports": [
94
+ "error",
95
+ { prefer: "type-imports", fixStyle: "inline-type-imports" }
96
+ ],
97
+ "@typescript-eslint/no-unused-vars": [
98
+ "error",
99
+ {
100
+ argsIgnorePattern: "^_",
101
+ varsIgnorePattern: "^_",
102
+ ignoreRestSiblings: true
103
+ }
104
+ ],
105
+ "@typescript-eslint/no-explicit-any": "warn",
106
+ "@typescript-eslint/no-empty-object-type": "off",
107
+ "@typescript-eslint/no-namespace": "off"
108
+ }
109
+ },
110
+ // General JavaScript rules
111
+ {
112
+ languageOptions: {
113
+ globals: {
114
+ ...globals2.es2022
115
+ }
116
+ },
117
+ rules: {
118
+ "no-console": ["error", { allow: ["warn", "error"] }],
119
+ eqeqeq: ["error", "smart"],
120
+ "no-eval": "error",
121
+ "no-var": "error",
122
+ "prefer-const": "error",
123
+ "prefer-template": "error",
124
+ "object-shorthand": "error"
125
+ }
126
+ },
127
+ // Prettier config to disable conflicting rules (must be last)
128
+ prettierConfig
129
+ );
130
+ }
131
+ var base = createBaseConfig();
132
+
133
+ // src/configs/react.ts
134
+ import jsxA11y from "eslint-plugin-jsx-a11y";
135
+ import reactPlugin from "eslint-plugin-react";
136
+ import reactHooks from "eslint-plugin-react-hooks";
137
+ import globals3 from "globals";
138
+ function createReactConfig(options = {}) {
139
+ const { features = {} } = options;
140
+ const enableA11y = features.a11y !== false;
141
+ const configs = [
142
+ // React plugin recommended config
143
+ {
144
+ files: ["**/*.{jsx,tsx}"],
145
+ plugins: {
146
+ react: reactPlugin
147
+ },
148
+ languageOptions: {
149
+ parserOptions: {
150
+ ecmaFeatures: {
151
+ jsx: true
152
+ }
153
+ },
154
+ globals: {
155
+ ...globals3.browser
156
+ }
157
+ },
158
+ settings: {
159
+ react: {
160
+ version: "detect"
161
+ }
162
+ },
163
+ rules: {
164
+ ...reactPlugin.configs.recommended.rules,
165
+ ...reactPlugin.configs["jsx-runtime"].rules
166
+ }
167
+ },
168
+ // React Hooks plugin
169
+ {
170
+ files: ["**/*.{js,jsx,ts,tsx}"],
171
+ plugins: {
172
+ "react-hooks": reactHooks
173
+ },
174
+ rules: {
175
+ ...reactHooks.configs.recommended.rules,
176
+ "react-hooks/exhaustive-deps": "warn"
177
+ }
178
+ },
179
+ // React-specific rule overrides
180
+ {
181
+ files: ["**/*.{jsx,tsx}"],
182
+ rules: {
183
+ "react/prop-types": "off",
184
+ // TypeScript handles this
185
+ "react/react-in-jsx-scope": "off",
186
+ // Not needed with React 17+ JSX transform
187
+ "react/jsx-no-target-blank": "error",
188
+ "react/jsx-no-duplicate-props": "error",
189
+ "react/jsx-pascal-case": ["error", { allowAllCaps: true }],
190
+ "react/no-danger-with-children": "error",
191
+ "react/no-deprecated": "warn",
192
+ "react/no-direct-mutation-state": "error",
193
+ "react/self-closing-comp": "error"
194
+ }
195
+ }
196
+ ];
197
+ if (enableA11y) {
198
+ configs.push({
199
+ files: ["**/*.{jsx,tsx}"],
200
+ ...jsxA11y.flatConfigs.recommended,
201
+ rules: {
202
+ ...jsxA11y.flatConfigs.recommended.rules,
203
+ "jsx-a11y/anchor-is-valid": "warn"
204
+ }
205
+ });
206
+ }
207
+ return configs;
208
+ }
209
+ var reactConfig = createReactConfig();
210
+
211
+ // src/prettier.ts
212
+ var prettierConfig2 = {
213
+ printWidth: 100,
214
+ singleQuote: true,
215
+ trailingComma: "all",
216
+ tabWidth: 2,
217
+ semi: true,
218
+ arrowParens: "always",
219
+ bracketSpacing: true
220
+ };
221
+
222
+ // src/index.ts
223
+ function instant(options = {}) {
224
+ const { type = "library", ignores = [] } = options;
225
+ const configs = [];
226
+ if (ignores.length > 0) {
227
+ configs.push({
228
+ ignores: [
229
+ "**/node_modules/**",
230
+ "**/dist/**",
231
+ "**/build/**",
232
+ "**/.next/**",
233
+ "**/coverage/**",
234
+ ...ignores
235
+ ]
236
+ });
237
+ } else {
238
+ configs.push({
239
+ ignores: [
240
+ "**/node_modules/**",
241
+ "**/dist/**",
242
+ "**/build/**",
243
+ "**/.next/**",
244
+ "**/coverage/**"
245
+ ]
246
+ });
247
+ }
248
+ configs.push(...createBaseConfig(options));
249
+ switch (type) {
250
+ case "react":
251
+ configs.push(...createReactConfig(options));
252
+ break;
253
+ case "backend":
254
+ configs.push(...createBackendConfig());
255
+ break;
256
+ case "library":
257
+ break;
258
+ }
259
+ return configs;
260
+ }
261
+ var index_default = instant;
262
+ export {
263
+ backend,
264
+ base,
265
+ createBackendConfig,
266
+ createBaseConfig,
267
+ createReactConfig,
268
+ index_default as default,
269
+ instant,
270
+ prettierConfig2 as prettierConfig,
271
+ reactConfig
272
+ };
273
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/configs/backend.ts","../src/configs/base.ts","../src/configs/react.ts","../src/prettier.ts","../src/index.ts"],"sourcesContent":["import nodePlugin from 'eslint-plugin-n';\nimport globals from 'globals';\n\nimport type { FlatConfigArray } from '../types.js';\n\nexport function createBackendConfig(): FlatConfigArray {\n return [\n // Node.js plugin recommended config\n nodePlugin.configs['flat/recommended'],\n\n // Node.js environment and rules\n {\n languageOptions: {\n globals: {\n ...globals.node,\n },\n },\n rules: {\n // Console logging rules for backend\n 'no-console': ['error', { allow: ['warn', 'error', 'info'] }],\n\n // Node.js specific rules\n 'n/no-unsupported-features/node-builtins': 'error',\n 'n/no-unsupported-features/es-syntax': 'off', // TypeScript handles this\n 'n/no-missing-import': 'off', // TypeScript handles this\n 'n/no-unpublished-import': 'off', // Often triggers false positives\n\n // Prefer modern patterns\n 'n/prefer-promises/fs': 'error',\n 'n/prefer-promises/dns': 'error',\n },\n },\n\n // Disable browser globals for backend\n {\n languageOptions: {\n globals: {\n window: 'off',\n document: 'off',\n },\n },\n },\n ] as FlatConfigArray;\n}\n\nexport const backend = createBackendConfig();\n","import eslint from '@eslint/js';\nimport prettierConfig from 'eslint-config-prettier';\nimport importX from 'eslint-plugin-import-x';\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\n\nimport type { InstantConfig, FlatConfigArray } from '../types.js';\n\nexport function createBaseConfig(options: InstantConfig = {}): FlatConfigArray {\n const { tsconfig = './tsconfig.json', aliases } = options;\n\n return tseslint.config(\n // Recommended ESLint rules\n eslint.configs.recommended,\n\n // TypeScript ESLint recommended rules\n ...tseslint.configs.recommended,\n\n // Import plugin configuration\n {\n plugins: {\n 'import-x': importX as unknown as Record<string, unknown>,\n },\n settings: {\n 'import-x/resolver': {\n typescript: {\n alwaysTryTypes: true,\n project: tsconfig,\n },\n ...(aliases && {\n alias: {\n map: Object.entries(aliases),\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n },\n }),\n },\n },\n rules: {\n // Import ordering\n 'import-x/order': [\n 'error',\n {\n groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],\n 'newlines-between': 'always',\n alphabetize: { order: 'asc', caseInsensitive: true },\n },\n ],\n 'import-x/no-duplicates': 'error',\n 'import-x/no-unresolved': 'error',\n 'import-x/first': 'error',\n },\n },\n\n // TypeScript-specific rules\n {\n rules: {\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n { prefer: 'type-imports', fixStyle: 'inline-type-imports' },\n ],\n '@typescript-eslint/no-unused-vars': [\n 'error',\n {\n argsIgnorePattern: '^_',\n varsIgnorePattern: '^_',\n ignoreRestSiblings: true,\n },\n ],\n '@typescript-eslint/no-explicit-any': 'warn',\n '@typescript-eslint/no-empty-object-type': 'off',\n '@typescript-eslint/no-namespace': 'off',\n },\n },\n\n // General JavaScript rules\n {\n languageOptions: {\n globals: {\n ...globals.es2022,\n },\n },\n rules: {\n 'no-console': ['error', { allow: ['warn', 'error'] }],\n eqeqeq: ['error', 'smart'],\n 'no-eval': 'error',\n 'no-var': 'error',\n 'prefer-const': 'error',\n 'prefer-template': 'error',\n 'object-shorthand': 'error',\n },\n },\n\n // Prettier config to disable conflicting rules (must be last)\n prettierConfig,\n ) as FlatConfigArray;\n}\n\nexport const base = createBaseConfig();\n","// @ts-expect-error - no types available\nimport jsxA11y from 'eslint-plugin-jsx-a11y';\nimport reactPlugin from 'eslint-plugin-react';\nimport reactHooks from 'eslint-plugin-react-hooks';\nimport globals from 'globals';\n\nimport type { InstantConfig, FlatConfigArray } from '../types.js';\n\nexport function createReactConfig(options: InstantConfig = {}): FlatConfigArray {\n const { features = {} } = options;\n const enableA11y = features.a11y !== false; // Default true for React\n\n const configs: FlatConfigArray = [\n // React plugin recommended config\n {\n files: ['**/*.{jsx,tsx}'],\n plugins: {\n react: reactPlugin,\n },\n languageOptions: {\n parserOptions: {\n ecmaFeatures: {\n jsx: true,\n },\n },\n globals: {\n ...globals.browser,\n },\n },\n settings: {\n react: {\n version: 'detect',\n },\n },\n rules: {\n ...reactPlugin.configs.recommended.rules,\n ...reactPlugin.configs['jsx-runtime'].rules,\n },\n },\n\n // React Hooks plugin\n {\n files: ['**/*.{js,jsx,ts,tsx}'],\n plugins: {\n 'react-hooks': reactHooks,\n },\n rules: {\n ...reactHooks.configs.recommended.rules,\n 'react-hooks/exhaustive-deps': 'warn',\n },\n },\n\n // React-specific rule overrides\n {\n files: ['**/*.{jsx,tsx}'],\n rules: {\n 'react/prop-types': 'off', // TypeScript handles this\n 'react/react-in-jsx-scope': 'off', // Not needed with React 17+ JSX transform\n 'react/jsx-no-target-blank': 'error',\n 'react/jsx-no-duplicate-props': 'error',\n 'react/jsx-pascal-case': ['error', { allowAllCaps: true }],\n 'react/no-danger-with-children': 'error',\n 'react/no-deprecated': 'warn',\n 'react/no-direct-mutation-state': 'error',\n 'react/self-closing-comp': 'error',\n },\n },\n ];\n\n // Add accessibility rules if enabled\n if (enableA11y) {\n configs.push({\n files: ['**/*.{jsx,tsx}'],\n ...jsxA11y.flatConfigs.recommended,\n rules: {\n ...jsxA11y.flatConfigs.recommended.rules,\n 'jsx-a11y/anchor-is-valid': 'warn',\n },\n });\n }\n\n return configs;\n}\n\nexport const reactConfig = createReactConfig();\n","import type { PrettierOptions } from './types.js';\n\n/**\n * Default Prettier configuration for Instant projects.\n * Use in .prettierrc.js:\n *\n * ```js\n * import { prettierConfig } from 'eslint-config-instant/prettier';\n * export default prettierConfig;\n * ```\n */\nexport const prettierConfig: PrettierOptions = {\n printWidth: 100,\n singleQuote: true,\n trailingComma: 'all',\n tabWidth: 2,\n semi: true,\n arrowParens: 'always',\n bracketSpacing: true,\n};\n","import { createBackendConfig } from './configs/backend.js';\nimport { createBaseConfig } from './configs/base.js';\nimport { createReactConfig } from './configs/react.js';\nimport type { InstantConfig, FlatConfigArray } from './types.js';\n\nexport type { InstantConfig, PrettierOptions, InstantConfigFeatures, FlatConfigArray } from './types.js';\nexport type { FlatConfig } from './types.js';\nexport { prettierConfig } from './prettier.js';\nexport { createBaseConfig, base } from './configs/base.js';\nexport { createReactConfig, reactConfig } from './configs/react.js';\nexport { createBackendConfig, backend } from './configs/backend.js';\n\n/**\n * Creates an ESLint flat config for Instant Commerce projects.\n *\n * @example\n * ```ts\n * // eslint.config.ts\n * import { instant } from 'eslint-config-instant';\n *\n * export default instant({\n * type: 'react',\n * features: {\n * a11y: true,\n * vitest: true,\n * },\n * });\n * ```\n */\nexport function instant(options: InstantConfig = {}): FlatConfigArray {\n const { type = 'library', ignores = [] } = options;\n\n const configs: FlatConfigArray = [];\n\n // Global ignores\n if (ignores.length > 0) {\n configs.push({\n ignores: [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.next/**',\n '**/coverage/**',\n ...ignores,\n ],\n });\n } else {\n configs.push({\n ignores: [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.next/**',\n '**/coverage/**',\n ],\n });\n }\n\n // Base config (always included)\n configs.push(...createBaseConfig(options));\n\n // Type-specific configs\n switch (type) {\n case 'react':\n configs.push(...createReactConfig(options));\n break;\n case 'backend':\n configs.push(...createBackendConfig());\n break;\n case 'library':\n // Library uses base config only\n break;\n }\n\n return configs;\n}\n\n// Default export for convenience\nexport default instant;\n"],"mappings":";AAAA,OAAO,gBAAgB;AACvB,OAAO,aAAa;AAIb,SAAS,sBAAuC;AACrD,SAAO;AAAA;AAAA,IAEL,WAAW,QAAQ,kBAAkB;AAAA;AAAA,IAGrC;AAAA,MACE,iBAAiB;AAAA,QACf,SAAS;AAAA,UACP,GAAG,QAAQ;AAAA,QACb;AAAA,MACF;AAAA,MACA,OAAO;AAAA;AAAA,QAEL,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,SAAS,MAAM,EAAE,CAAC;AAAA;AAAA,QAG5D,2CAA2C;AAAA,QAC3C,uCAAuC;AAAA;AAAA,QACvC,uBAAuB;AAAA;AAAA,QACvB,2BAA2B;AAAA;AAAA;AAAA,QAG3B,wBAAwB;AAAA,QACxB,yBAAyB;AAAA,MAC3B;AAAA,IACF;AAAA;AAAA,IAGA;AAAA,MACE,iBAAiB;AAAA,QACf,SAAS;AAAA,UACP,QAAQ;AAAA,UACR,UAAU;AAAA,QACZ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,UAAU,oBAAoB;;;AC7C3C,OAAO,YAAY;AACnB,OAAO,oBAAoB;AAC3B,OAAO,aAAa;AACpB,OAAOA,cAAa;AACpB,OAAO,cAAc;AAId,SAAS,iBAAiB,UAAyB,CAAC,GAAoB;AAC7E,QAAM,EAAE,WAAW,mBAAmB,QAAQ,IAAI;AAElD,SAAO,SAAS;AAAA;AAAA,IAEd,OAAO,QAAQ;AAAA,IA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AAGA,IAAO,gBAAQ;","names":["globals","globals","prettierConfig"]}
@@ -0,0 +1,15 @@
1
+ import { P as PrettierOptions } from './types-Ce23S_AX.js';
2
+ import 'eslint';
3
+
4
+ /**
5
+ * Default Prettier configuration for Instant projects.
6
+ * Use in .prettierrc.js:
7
+ *
8
+ * ```js
9
+ * import { prettierConfig } from 'eslint-config-instant/prettier';
10
+ * export default prettierConfig;
11
+ * ```
12
+ */
13
+ declare const prettierConfig: PrettierOptions;
14
+
15
+ export { prettierConfig };
@@ -0,0 +1,14 @@
1
+ // src/prettier.ts
2
+ var prettierConfig = {
3
+ printWidth: 100,
4
+ singleQuote: true,
5
+ trailingComma: "all",
6
+ tabWidth: 2,
7
+ semi: true,
8
+ arrowParens: "always",
9
+ bracketSpacing: true
10
+ };
11
+ export {
12
+ prettierConfig
13
+ };
14
+ //# sourceMappingURL=prettier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/prettier.ts"],"sourcesContent":["import type { PrettierOptions } from './types.js';\n\n/**\n * Default Prettier configuration for Instant projects.\n * Use in .prettierrc.js:\n *\n * ```js\n * import { prettierConfig } from 'eslint-config-instant/prettier';\n * export default prettierConfig;\n * ```\n */\nexport const prettierConfig: PrettierOptions = {\n printWidth: 100,\n singleQuote: true,\n trailingComma: 'all',\n tabWidth: 2,\n semi: true,\n arrowParens: 'always',\n bracketSpacing: true,\n};\n"],"mappings":";AAWO,IAAM,iBAAkC;AAAA,EAC7C,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,eAAe;AAAA,EACf,UAAU;AAAA,EACV,MAAM;AAAA,EACN,aAAa;AAAA,EACb,gBAAgB;AAClB;","names":[]}
@@ -0,0 +1,40 @@
1
+ import { Linter } from 'eslint';
2
+
3
+ interface PrettierOptions {
4
+ printWidth?: number;
5
+ tabWidth?: number;
6
+ useTabs?: boolean;
7
+ semi?: boolean;
8
+ singleQuote?: boolean;
9
+ trailingComma?: 'none' | 'es5' | 'all';
10
+ bracketSpacing?: boolean;
11
+ arrowParens?: 'avoid' | 'always';
12
+ }
13
+ interface InstantConfigFeatures {
14
+ /** Enable accessibility rules (jsx-a11y) - default: true for react */
15
+ a11y?: boolean;
16
+ /** Enable MDX file support - default: false */
17
+ mdx?: boolean;
18
+ /** Enable testing-library rules - default: false */
19
+ testingLibrary?: boolean;
20
+ /** Enable vitest rules - default: false */
21
+ vitest?: boolean;
22
+ }
23
+ interface InstantConfig {
24
+ /** Project type determines which rule sets to include */
25
+ type?: 'react' | 'backend' | 'library';
26
+ /** TypeScript config path(s) for type-aware linting - auto-detected if not provided */
27
+ tsconfig?: string | string[];
28
+ /** Path aliases for import resolution (in addition to tsconfig paths) */
29
+ aliases?: Record<string, string>;
30
+ /** Prettier options - used when prettier feature is enabled */
31
+ prettier?: PrettierOptions;
32
+ /** Additional ignore patterns */
33
+ ignores?: string[];
34
+ /** Enable/disable specific rule sets */
35
+ features?: InstantConfigFeatures;
36
+ }
37
+ type FlatConfig = Linter.Config;
38
+ type FlatConfigArray = Linter.Config[];
39
+
40
+ export type { FlatConfigArray as F, InstantConfig as I, PrettierOptions as P, FlatConfig as a, InstantConfigFeatures as b };
package/package.json CHANGED
@@ -1,57 +1,102 @@
1
1
  {
2
2
  "name": "eslint-config-instant",
3
- "version": "2.4.0",
4
- "repository": {
5
- "type": "git",
6
- "url": "https://github.com/instantcommerce/eslint-config-instant"
3
+ "version": "2.6.0-next.5",
4
+ "description": "A shareable ESLint flat config for Instant Commerce projects",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "default": "./dist/index.js"
10
+ },
11
+ "./react": {
12
+ "types": "./dist/configs/react.d.ts",
13
+ "default": "./dist/configs/react.js"
14
+ },
15
+ "./backend": {
16
+ "types": "./dist/configs/backend.d.ts",
17
+ "default": "./dist/configs/backend.js"
18
+ },
19
+ "./base": {
20
+ "types": "./dist/configs/base.d.ts",
21
+ "default": "./dist/configs/base.js"
22
+ },
23
+ "./prettier": {
24
+ "types": "./dist/prettier.d.ts",
25
+ "default": "./dist/prettier.js"
26
+ }
27
+ },
28
+ "types": "./dist/index.d.ts",
29
+ "bin": {
30
+ "eslint-config-instant": "./dist/cli.js"
7
31
  },
8
- "main": "index.js",
9
32
  "files": [
10
- "index.js",
11
- "react.js",
12
- "backend.js"
33
+ "dist"
13
34
  ],
35
+ "engines": {
36
+ "node": ">=20"
37
+ },
14
38
  "scripts": {
39
+ "build": "tsup",
40
+ "dev": "tsup --watch",
15
41
  "lint": "eslint .",
16
- "lint:fix": "eslint --fix",
42
+ "lint:fix": "eslint . --fix",
43
+ "test": "vitest run",
44
+ "test:watch": "vitest",
45
+ "typecheck": "tsc --noEmit",
46
+ "prepublishOnly": "npm run build",
17
47
  "semantic-release": "semantic-release"
18
48
  },
19
49
  "peerDependencies": {
20
- "eslint": "8.17.0",
21
- "eslint-config-prettier": "8.5.0",
22
- "eslint-import-resolver-alias": "1.1.2",
23
- "eslint-plugin-import": "2.26.0",
24
- "eslint-plugin-prettier": "4.0.0",
25
- "prettier": "2.6.2",
26
- "typescript": "4.7.3"
50
+ "eslint": ">=9.0.0",
51
+ "typescript": ">=5.0.0"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "typescript": {
55
+ "optional": true
56
+ }
57
+ },
58
+ "dependencies": {
59
+ "@eslint/js": "^9.18.0",
60
+ "eslint-config-prettier": "^10.0.1",
61
+ "eslint-import-resolver-typescript": "^3.7.0",
62
+ "eslint-plugin-import-x": "^4.6.1",
63
+ "eslint-plugin-jsx-a11y": "^6.10.2",
64
+ "eslint-plugin-n": "^17.15.1",
65
+ "eslint-plugin-react": "^7.37.4",
66
+ "eslint-plugin-react-hooks": "^5.1.0",
67
+ "globals": "^15.14.0",
68
+ "prompts": "^2.4.2",
69
+ "typescript-eslint": "^8.21.0"
27
70
  },
28
71
  "devDependencies": {
29
- "@commitlint/cli": "17.0.2",
30
- "@commitlint/config-conventional": "17.0.2",
31
- "@semantic-release/changelog": "6.0.1",
32
- "@typescript-eslint/eslint-plugin": "5.27.0",
33
- "@typescript-eslint/parser": "5.27.0",
34
- "eslint": "8.17.0",
35
- "eslint-config-prettier": "8.5.0",
36
- "eslint-import-resolver-alias": "1.1.2",
37
- "eslint-plugin-import": "2.26.0",
38
- "eslint-plugin-jest": "26.5.3",
39
- "eslint-plugin-jsx-a11y": "6.5.1",
40
- "eslint-plugin-mdx": "1.17.0",
41
- "eslint-plugin-prettier": "4.0.0",
42
- "eslint-plugin-react": "7.30.0",
43
- "eslint-plugin-react-hooks": "4.5.0",
44
- "prettier": "2.6.2",
45
- "semantic-release": "21.0.2",
46
- "typescript": "4.7.3"
72
+ "@semantic-release/changelog": "^6.0.3",
73
+ "@semantic-release/git": "^10.0.1",
74
+ "@types/eslint": "^9.6.1",
75
+ "@types/node": "^22.10.7",
76
+ "@types/prompts": "^2.4.9",
77
+ "eslint": "^9.18.0",
78
+ "jiti": "^2.6.1",
79
+ "prettier": "^3.4.2",
80
+ "semantic-release": "^25.0.2",
81
+ "tsup": "^8.3.5",
82
+ "typescript": "^5.7.3",
83
+ "vitest": "^2.1.8"
47
84
  },
85
+ "keywords": [
86
+ "eslint",
87
+ "eslintconfig",
88
+ "eslint-config",
89
+ "flat-config",
90
+ "typescript",
91
+ "react",
92
+ "instant"
93
+ ],
48
94
  "license": "MIT",
49
95
  "publishConfig": {
50
96
  "access": "public"
51
97
  },
52
- "eslintConfig": {
53
- "extends": [
54
- "./index.js"
55
- ]
98
+ "repository": {
99
+ "type": "git",
100
+ "url": "https://github.com/instantcommerce/eslint-config-instant.git"
56
101
  }
57
102
  }