@jmlweb/eslint-config-base 1.0.0 → 2.0.1

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 ADDED
@@ -0,0 +1,15 @@
1
+ # @jmlweb/eslint-config-base
2
+
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 2208f74: Standardize repository field format to object format across all packages and configure syncpack to preserve it.
8
+ - Updated dependencies [2208f74]
9
+ - @jmlweb/eslint-config-base-js@1.0.1
10
+
11
+ ## 2.0.0
12
+
13
+ ### Major Changes
14
+
15
+ - fb7ebe3: Enforce named exports only by adding no-restricted-exports rule
package/README.md CHANGED
@@ -14,6 +14,7 @@
14
14
  - 🛡️ **Type Safety**: Enforces explicit return types and prevents `any` usage
15
15
  - 📦 **Import Management**: Enforces type-only imports with inline style + automatic sorting
16
16
  - 🎯 **Best Practices**: Prevents enum usage, encourages immutability, enforces naming conventions
17
+ - 🚫 **No Default Exports**: Enforces named exports for better tree-shaking and clearer imports
17
18
  - 🎨 **Prettier Integration**: Disables all ESLint rules that conflict with Prettier
18
19
  - 🚀 **Flat Config**: Uses ESLint 9+ flat config format (latest stable)
19
20
  - 🔧 **Extensible**: Built on `@jmlweb/eslint-config-base-js` foundation
@@ -88,6 +89,25 @@ export default [
88
89
  ];
89
90
  ```
90
91
 
92
+ ### Allowing Default Exports
93
+
94
+ This config forbids default exports by default for better tree-shaking and clearer imports. If you need default exports (e.g., for config files or specific libraries):
95
+
96
+ ```javascript
97
+ // eslint.config.js
98
+ import baseConfig from '@jmlweb/eslint-config-base';
99
+
100
+ export default [
101
+ ...baseConfig,
102
+ {
103
+ files: ['*.config.ts', '*.config.js'],
104
+ rules: {
105
+ 'no-restricted-exports': 'off',
106
+ },
107
+ },
108
+ ];
109
+ ```
110
+
91
111
  ### Less Strict Configuration
92
112
 
93
113
  This config uses strict type checking by default. If you need non-strict rules, you have two options:
@@ -150,15 +170,15 @@ This configuration applies strict TypeScript rules to:
150
170
 
151
171
  ### Key Rules Enforced
152
172
 
153
- | Rule | Level | Description |
154
- | -------------------------------------------------- | ------- | -------------------------------------------- |
155
- | `@typescript-eslint/no-explicit-any` | `error` | Prevents `any` type usage |
156
- | `@typescript-eslint/explicit-function-return-type` | `error` | Requires explicit return types |
157
- | `@typescript-eslint/consistent-type-imports` | `error` | Enforces `import type` for type-only imports |
158
- | `@typescript-eslint/consistent-type-definitions` | `error` | Prefers `type` over `interface` |
159
- | `@typescript-eslint/no-enum` | `error` | Prevents enum usage (prefer const maps) |
160
- | `@typescript-eslint/no-parameter-properties` | `error` | Prevents parameter properties |
161
- | `@typescript-eslint/naming-convention` | `error` | Enforces naming conventions |
173
+ | Rule | Level | Description |
174
+ | -------------------------------------------------- | ------- | --------------------------------------------- |
175
+ | `@typescript-eslint/no-explicit-any` | `error` | Prevents `any` type usage |
176
+ | `@typescript-eslint/explicit-function-return-type` | `error` | Requires explicit return types |
177
+ | `@typescript-eslint/consistent-type-imports` | `error` | Enforces `import type` for type-only imports |
178
+ | `@typescript-eslint/consistent-type-definitions` | `error` | Prefers `type` over `interface` |
179
+ | `no-restricted-syntax` (TSEnumDeclaration) | `error` | Prevents enum usage (prefer const maps) |
180
+ | `no-restricted-exports` | `error` | Prevents default exports (named exports only) |
181
+ | `@typescript-eslint/naming-convention` | `error` | Enforces naming conventions |
162
182
 
163
183
  ### What's Included
164
184
 
@@ -202,7 +222,7 @@ npx eslint --fix .
202
222
 
203
223
  Use this configuration when you want:
204
224
 
205
- - ✅ Maximum type safety
225
+ - ✅ Maximum type safety with strict TypeScript rules
206
226
  - ✅ Strict code quality standards
207
227
  - ✅ Consistent code style across the team
208
228
  - ✅ Prevention of common TypeScript pitfalls
@@ -210,6 +230,8 @@ Use this configuration when you want:
210
230
 
211
231
  **For JavaScript-only projects**, use [`@jmlweb/eslint-config-base-js`](../eslint-config-base-js) instead.
212
232
 
233
+ **For React projects**, use [`@jmlweb/eslint-config-react`](../eslint-config-react) instead.
234
+
213
235
  **For less strict projects**, you can override the strict rules as shown in the examples above.
214
236
 
215
237
  ## 🔧 Extending the Configuration
@@ -247,6 +269,13 @@ Add linting scripts to your `package.json`:
247
269
  }
248
270
  ```
249
271
 
272
+ Then run:
273
+
274
+ ```bash
275
+ npm run lint # Lint all files
276
+ npm run lint:fix # Fix auto-fixable issues
277
+ ```
278
+
250
279
  ## 📋 Requirements
251
280
 
252
281
  - **Node.js** >= 20.11.0 (required for `import.meta.dirname` in config files)
@@ -265,9 +294,16 @@ This package requires the following peer dependencies:
265
294
  - `eslint-plugin-simple-import-sort` (^12.0.0)
266
295
  - `@jmlweb/eslint-config-base-js` (workspace or published version)
267
296
 
297
+ ## 📚 Examples
298
+
299
+ See real-world usage examples:
300
+
301
+ - [`example-nodejs-typescript-api`](../../apps/example-nodejs-typescript-api) - Node.js TypeScript API example
302
+
268
303
  ## 🔗 Related Packages
269
304
 
270
305
  - [`@jmlweb/eslint-config-base-js`](../eslint-config-base-js) - JavaScript ESLint config (extended by this package)
306
+ - [`@jmlweb/eslint-config-react`](../eslint-config-react) - ESLint config for React projects
271
307
  - [`@jmlweb/prettier-config-base`](../prettier-config-base) - Prettier config for consistent formatting
272
308
  - [`@jmlweb/tsconfig-base`](../tsconfig-base) - TypeScript configuration
273
309
 
package/dist/index.cjs CHANGED
@@ -91,7 +91,20 @@ var config = import_typescript_eslint.default.config(
91
91
  }
92
92
  ],
93
93
  // Encourage immutability (functional programming)
94
- "no-param-reassign": ["error", { props: true }]
94
+ "no-param-reassign": ["error", { props: true }],
95
+ // Enforce named exports only (no default exports)
96
+ "no-restricted-exports": [
97
+ "error",
98
+ {
99
+ restrictDefaultExports: {
100
+ direct: true,
101
+ named: true,
102
+ defaultFrom: true,
103
+ namedFrom: true,
104
+ namespaceFrom: true
105
+ }
106
+ }
107
+ ]
95
108
  }
96
109
  }
97
110
  );
package/dist/index.js CHANGED
@@ -57,7 +57,20 @@ var config = tseslint.config(
57
57
  }
58
58
  ],
59
59
  // Encourage immutability (functional programming)
60
- "no-param-reassign": ["error", { props: true }]
60
+ "no-param-reassign": ["error", { props: true }],
61
+ // Enforce named exports only (no default exports)
62
+ "no-restricted-exports": [
63
+ "error",
64
+ {
65
+ restrictDefaultExports: {
66
+ direct: true,
67
+ named: true,
68
+ defaultFrom: true,
69
+ namedFrom: true,
70
+ namespaceFrom: true
71
+ }
72
+ }
73
+ ]
61
74
  }
62
75
  }
63
76
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jmlweb/eslint-config-base",
3
- "version": "1.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Base ESLint configuration for TypeScript projects with strict type checking and best practices",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -8,32 +8,28 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "require": {
12
- "types": "./dist/index.d.cts",
13
- "default": "./dist/index.cjs"
14
- },
15
11
  "import": {
16
12
  "types": "./dist/index.d.ts",
17
13
  "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
18
  }
19
19
  }
20
20
  },
21
21
  "files": [
22
22
  "dist",
23
- "README.md"
23
+ "README.md",
24
+ "CHANGELOG.md"
24
25
  ],
25
- "scripts": {
26
- "build": "tsup",
27
- "clean": "rm -rf dist",
28
- "prepublishOnly": "pnpm build"
29
- },
30
26
  "keywords": [
27
+ "code-quality",
31
28
  "eslint",
32
29
  "eslint-config",
33
- "typescript",
34
30
  "javascript",
35
31
  "linting",
36
- "code-quality"
32
+ "typescript"
37
33
  ],
38
34
  "author": "jmlweb",
39
35
  "license": "MIT",
@@ -41,9 +37,7 @@
41
37
  "type": "git",
42
38
  "url": "https://github.com/jmlweb/tooling.git"
43
39
  },
44
- "bugs": {
45
- "url": "https://github.com/jmlweb/tooling/issues"
46
- },
40
+ "bugs": "https://github.com/jmlweb/tooling/issues",
47
41
  "homepage": "https://github.com/jmlweb/tooling/tree/main/packages/eslint-config-base#readme",
48
42
  "engines": {
49
43
  "node": ">=20.11.0"
@@ -59,17 +53,21 @@
59
53
  "typescript-eslint": "^8.0.0"
60
54
  },
61
55
  "dependencies": {
62
- "@jmlweb/eslint-config-base-js": "workspace:*"
56
+ "@jmlweb/eslint-config-base-js": "1.0.1"
63
57
  },
64
58
  "devDependencies": {
65
59
  "@eslint/js": "^9.39.2",
66
- "@jmlweb/tsconfig-internal": "workspace:*",
67
60
  "@types/eslint": "^9.6.1",
68
61
  "eslint": "^9.39.2",
69
62
  "eslint-config-prettier": "^10.1.8",
70
63
  "eslint-plugin-simple-import-sort": "^12.1.1",
71
64
  "tsup": "^8.5.1",
72
65
  "typescript": "^5.9.3",
73
- "typescript-eslint": "^8.34.1"
66
+ "typescript-eslint": "^8.34.1",
67
+ "@jmlweb/tsconfig-internal": "0.0.1"
68
+ },
69
+ "scripts": {
70
+ "build": "tsup",
71
+ "clean": "rm -rf dist"
74
72
  }
75
- }
73
+ }