@vortiquo/eslint-config 1.2.2-beta.1 → 1.2.2-beta.2

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.
@@ -18,29 +18,34 @@ const TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
18
18
  export const baseTypescript = [
19
19
  ...base,
20
20
 
21
- // Apply type-checked configs ONLY to TypeScript files
22
- // We need to filter out configs that don't have rules (plugin definitions)
23
- // and only add files restriction to configs that have rules
24
- ...tseslint.configs.strictTypeChecked.map((config) => {
25
- // If this config has rules, scope it to TS files only
26
- if (config.rules && Object.keys(config.rules).length > 0) {
27
- return { ...config, files: TS_FILES };
28
- }
29
- // Plugin/parser configs stay global but we add files to scope parsing
30
- if (config.languageOptions?.parser) {
31
- return { ...config, files: TS_FILES };
32
- }
33
- // Plugin registration stays global (no files restriction)
34
- return config;
35
- }),
36
- ...tseslint.configs.stylisticTypeChecked.map((config) => {
37
- if (config.rules && Object.keys(config.rules).length > 0) {
38
- return { ...config, files: TS_FILES };
39
- }
40
- if (config.languageOptions?.parser) {
41
- return { ...config, files: TS_FILES };
42
- }
43
- return config;
21
+ // Global TypeScript plugin registration (plugins must be defined globally)
22
+ {
23
+ name: 'vortiquo/typescript-plugins',
24
+ plugins: {
25
+ '@typescript-eslint': tseslint.plugin,
26
+ },
27
+ },
28
+
29
+ // TypeScript parser and language options (scoped to TS files)
30
+ {
31
+ name: 'vortiquo/typescript-parser',
32
+ files: TS_FILES,
33
+ languageOptions: {
34
+ parser: tseslint.parser,
35
+ parserOptions: {
36
+ projectService: true,
37
+ },
38
+ },
39
+ },
40
+
41
+ // Apply type-checked rules ONLY to TypeScript files
42
+ // Use the recommended approach from typescript-eslint docs
43
+ ...tseslint.config({
44
+ files: TS_FILES,
45
+ extends: [
46
+ tseslint.configs.strictTypeChecked,
47
+ tseslint.configs.stylisticTypeChecked,
48
+ ],
44
49
  }),
45
50
 
46
51
  // TypeScript-specific settings and rules (only for TS files)
package/node-library.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import globals from 'globals';
2
2
  import { baseTypescript } from './base-typescript.js';
3
3
 
4
+ /**
5
+ * TypeScript file patterns - type-aware rules only apply to these
6
+ */
7
+ const TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
8
+
4
9
  /**
5
10
  * ESLint configuration for Node.js libraries/packages.
6
11
  * Extends TypeScript config for shared backend packages.
@@ -16,14 +21,19 @@ export const nodeLibrary = [
16
21
  ...globals.node,
17
22
  },
18
23
  },
24
+ rules: {
25
+ // No console in libraries (consumers should handle logging)
26
+ 'no-console': 'error',
27
+ },
28
+ },
29
+ {
30
+ name: 'vortiquo/node-library/typescript',
31
+ files: TS_FILES,
19
32
  rules: {
20
33
  // Libraries should be strict
21
34
  '@typescript-eslint/explicit-function-return-type': 'error',
22
35
  '@typescript-eslint/explicit-module-boundary-types': 'error',
23
36
 
24
- // No console in libraries (consumers should handle logging)
25
- 'no-console': 'error',
26
-
27
37
  // Async handling
28
38
  '@typescript-eslint/no-floating-promises': 'error',
29
39
  '@typescript-eslint/require-await': 'error',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vortiquo/eslint-config",
3
- "version": "1.2.2-beta.1",
3
+ "version": "1.2.2-beta.2",
4
4
  "description": "Modern ESLint v9 flat configurations with TypeScript, React, Next.js, and Node.js support",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -14,8 +14,9 @@
14
14
  "lint": "ls-lint",
15
15
  "format": "prettier --write .",
16
16
  "format:check": "prettier --check .",
17
- "test": "node scripts/validate-configs.js",
18
- "prepack": "node scripts/validate-configs.js",
17
+ "test": "node scripts/validate-configs.js && node tests/test-configs.js",
18
+ "test:configs": "node tests/test-configs.js",
19
+ "prepack": "npm run test",
19
20
  "commit": "cz",
20
21
  "prepare": "husky"
21
22
  },
package/react-library.js CHANGED
@@ -1,5 +1,10 @@
1
1
  import { react } from './react.js';
2
2
 
3
+ /**
4
+ * TypeScript file patterns - type-aware rules only apply to these
5
+ */
6
+ const TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
7
+
3
8
  /**
4
9
  * ESLint configuration for React component libraries.
5
10
  * Extends React config with library-specific rules.
@@ -11,9 +16,6 @@ export const reactLibrary = [
11
16
  {
12
17
  name: 'vortiquo/react-library',
13
18
  rules: {
14
- // Libraries should be stricter about exports
15
- '@typescript-eslint/explicit-module-boundary-types': 'error',
16
-
17
19
  // No console in libraries
18
20
  'no-console': 'error',
19
21
 
@@ -21,6 +23,14 @@ export const reactLibrary = [
21
23
  'import/no-default-export': 'error',
22
24
  },
23
25
  },
26
+ {
27
+ name: 'vortiquo/react-library/typescript',
28
+ files: TS_FILES,
29
+ rules: {
30
+ // Libraries should be stricter about exports
31
+ '@typescript-eslint/explicit-module-boundary-types': 'error',
32
+ },
33
+ },
24
34
  {
25
35
  name: 'vortiquo/react-library/config-files',
26
36
  files: ['**/*.config.{js,ts,mjs}', '**/tsup.config.ts'],
package/server.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import globals from 'globals';
2
2
  import { baseTypescript } from './base-typescript.js';
3
3
 
4
+ /**
5
+ * TypeScript file patterns - type-aware rules only apply to these
6
+ */
7
+ const TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
8
+
4
9
  /**
5
10
  * ESLint configuration for backend APIs (Fastify, Express, Hono).
6
11
  * Extends TypeScript config with Node.js-specific rules.
@@ -22,7 +27,12 @@ export const server = [
22
27
 
23
28
  // Backend-specific rules
24
29
  'no-process-exit': 'off',
25
-
30
+ },
31
+ },
32
+ {
33
+ name: 'vortiquo/server/typescript',
34
+ files: TS_FILES,
35
+ rules: {
26
36
  // Stricter for backend code
27
37
  '@typescript-eslint/explicit-function-return-type': 'error',
28
38
  '@typescript-eslint/explicit-module-boundary-types': 'error',