@travetto/eslint 5.0.0-rc.8 → 5.0.0-rc.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/eslint",
3
- "version": "5.0.0-rc.8",
3
+ "version": "5.0.0-rc.9",
4
4
  "description": "ES Linting Rules",
5
5
  "keywords": [
6
6
  "eslint",
@@ -24,17 +24,17 @@
24
24
  "directory": "module/eslint"
25
25
  },
26
26
  "dependencies": {
27
- "@eslint/js": "^8.56.0",
28
- "@travetto/runtime": "^5.0.0-rc.8",
29
- "@types/eslint": "^8.56.10",
27
+ "@eslint/js": "^9.9.0",
28
+ "@travetto/runtime": "^5.0.0-rc.9",
29
+ "@types/eslint": "^9.6.0",
30
30
  "@types/eslint__js": "^8.42.3",
31
- "@typescript-eslint/eslint-plugin": "^7.15.0",
32
- "@typescript-eslint/parser": "^7.15.0",
33
- "eslint": "^8.57.0",
34
- "eslint-plugin-unused-imports": "^3.2.0"
31
+ "@typescript-eslint/eslint-plugin": "^8.0.1",
32
+ "@typescript-eslint/parser": "^8.0.1",
33
+ "@stylistic/eslint-plugin": "^2.6.2",
34
+ "eslint": "^9.9.0"
35
35
  },
36
36
  "peerDependencies": {
37
- "@travetto/cli": "^5.0.0-rc.8"
37
+ "@travetto/cli": "^5.0.0-rc.9"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@travetto/cli": {
@@ -1,106 +1,94 @@
1
1
  import * as parser from '@typescript-eslint/parser';
2
2
 
3
- import { Runtime } from '@travetto/runtime';
4
-
5
- export const RULE_COMMON = {
6
- languageOptions: {
7
- ecmaVersion: 'latest',
8
- sourceType: Runtime.workspace.type,
9
- globals: {
10
- AbortController: false,
11
- AbortSignal: false,
12
- AggregateError: false,
13
- Array: false,
14
- ArrayBuffer: false,
15
- Atomics: false,
16
- BigInt: false,
17
- BigInt64Array: false,
18
- BigUint64Array: false,
19
- Boolean: false,
20
- Buffer: false,
21
- clearImmediate: false,
22
- clearInterval: false,
23
- clearTimeout: false,
24
- console: false,
25
- DataView: false,
26
- Date: false,
27
- decodeURI: false,
28
- decodeURIComponent: false,
29
- DOMException: false,
30
- encodeURI: false,
31
- encodeURIComponent: false,
32
- Error: false,
33
- EvalError: false,
34
- Event: false,
35
- EventTarget: false,
36
- fetch: false,
37
- FinalizationRegistry: false,
38
- Float32Array: false,
39
- Float64Array: false,
40
- FormData: false,
41
- Function: false,
42
- global: false,
43
- globalThis: false,
44
- Headers: false,
45
- Infinity: false,
46
- Int16Array: false,
47
- Int32Array: false,
48
- Int8Array: false,
49
- Intl: false,
50
- isFinite: false,
51
- isNaN: false,
52
- JSON: false,
53
- Map: false,
54
- Math: false,
55
- MessageChannel: false,
56
- MessageEvent: false,
57
- MessagePort: false,
58
- NaN: false,
59
- Number: false,
60
- Object: false,
61
- parseFloat: false,
62
- parseInt: false,
63
- performance: false,
64
- process: false,
65
- Promise: false,
66
- propertyIsEnumerable: false,
67
- Proxy: false,
68
- queueMicrotask: false,
69
- RangeError: false,
70
- ReferenceError: false,
71
- Reflect: false,
72
- RegExp: false,
73
- Request: false,
74
- require: false,
75
- Response: false,
76
- Set: false,
77
- setImmediate: false,
78
- setInterval: false,
79
- setTimeout: false,
80
- SharedArrayBuffer: false,
81
- String: false,
82
- structuredClone: false,
83
- Symbol: false,
84
- SyntaxError: false,
85
- TextDecoder: false,
86
- TextEncoder: false,
87
- TypeError: false,
88
- Uint16Array: false,
89
- Uint32Array: false,
90
- Uint8Array: false,
91
- Uint8ClampedArray: false,
92
- undefined: false,
93
- unescape: false,
94
- URIError: false,
95
- WeakMap: false,
96
- WeakRef: false,
97
- WeakSet: false,
98
- },
99
- parser,
100
- parserOptions: {
101
- project: 'tsconfig.json'
102
- },
103
- },
3
+ export const GLOBALS = {
4
+ AbortController: false,
5
+ AbortSignal: false,
6
+ AggregateError: false,
7
+ Array: false,
8
+ ArrayBuffer: false,
9
+ Atomics: false,
10
+ BigInt: false,
11
+ BigInt64Array: false,
12
+ BigUint64Array: false,
13
+ Boolean: false,
14
+ Buffer: false,
15
+ clearImmediate: false,
16
+ clearInterval: false,
17
+ clearTimeout: false,
18
+ console: false,
19
+ DataView: false,
20
+ Date: false,
21
+ decodeURI: false,
22
+ decodeURIComponent: false,
23
+ DOMException: false,
24
+ encodeURI: false,
25
+ encodeURIComponent: false,
26
+ Error: false,
27
+ EvalError: false,
28
+ Event: false,
29
+ EventTarget: false,
30
+ fetch: false,
31
+ FinalizationRegistry: false,
32
+ Float32Array: false,
33
+ Float64Array: false,
34
+ FormData: false,
35
+ Function: false,
36
+ global: false,
37
+ globalThis: false,
38
+ Headers: false,
39
+ Infinity: false,
40
+ Int16Array: false,
41
+ Int32Array: false,
42
+ Int8Array: false,
43
+ Intl: false,
44
+ isFinite: false,
45
+ isNaN: false,
46
+ JSON: false,
47
+ Map: false,
48
+ Math: false,
49
+ MessageChannel: false,
50
+ MessageEvent: false,
51
+ MessagePort: false,
52
+ NaN: false,
53
+ Number: false,
54
+ Object: false,
55
+ parseFloat: false,
56
+ parseInt: false,
57
+ performance: false,
58
+ process: false,
59
+ Promise: false,
60
+ propertyIsEnumerable: false,
61
+ Proxy: false,
62
+ queueMicrotask: false,
63
+ RangeError: false,
64
+ ReferenceError: false,
65
+ Reflect: false,
66
+ RegExp: false,
67
+ Request: false,
68
+ require: false,
69
+ Response: false,
70
+ Set: false,
71
+ setImmediate: false,
72
+ setInterval: false,
73
+ setTimeout: false,
74
+ SharedArrayBuffer: false,
75
+ String: false,
76
+ structuredClone: false,
77
+ Symbol: false,
78
+ SyntaxError: false,
79
+ TextDecoder: false,
80
+ TextEncoder: false,
81
+ TypeError: false,
82
+ Uint16Array: false,
83
+ Uint32Array: false,
84
+ Uint8Array: false,
85
+ Uint8ClampedArray: false,
86
+ undefined: false,
87
+ unescape: false,
88
+ URIError: false,
89
+ WeakMap: false,
90
+ WeakRef: false,
91
+ WeakSet: false,
104
92
  };
105
93
 
106
94
  export const IGNORES = [
@@ -110,4 +98,14 @@ export const IGNORES = [
110
98
  '**/*.d.ts',
111
99
  '**/fixtures/**/*',
112
100
  '**/resources/**/*'
113
- ];
101
+ ];
102
+
103
+ export const TS_OPTIONS = {
104
+ languageOptions: {
105
+ globals: GLOBALS,
106
+ ecmaVersion: 'latest',
107
+ parser,
108
+ sourceType: 'module',
109
+ parserOptions: { project: 'tsconfig.json' },
110
+ },
111
+ };
@@ -1,13 +1,12 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
 
3
- // @ts-expect-error
4
- import unused from 'eslint-plugin-unused-imports';
5
3
  import { configs } from '@eslint/js';
6
4
  import tsEslintPlugin from '@typescript-eslint/eslint-plugin';
5
+ import stylisticPlugin from '@stylistic/eslint-plugin';
7
6
 
8
7
  import { Runtime } from '@travetto/runtime';
9
8
 
10
- import { IGNORES, RULE_COMMON } from './eslint-common';
9
+ import { IGNORES, GLOBALS, TS_OPTIONS } from './eslint-common';
11
10
  import { STD_RULES } from './eslint-std-rules';
12
11
  import { TrvEslintPlugin } from './types';
13
12
 
@@ -28,15 +27,15 @@ export function buildConfig(pluginMaps: Record<string, TrvEslintPlugin>[]): read
28
27
  configs.recommended,
29
28
  { ignores: IGNORES, },
30
29
  {
31
- ...RULE_COMMON,
32
- files: ['**/*.ts', '**/*.tsx', '**/*.js'],
30
+ ...TS_OPTIONS,
31
+ files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'],
33
32
  plugins: {
33
+ '@stylistic': {
34
+ rules: stylisticPlugin.rules
35
+ },
34
36
  '@typescript-eslint': {
35
37
  rules: tsEslintPlugin.rules,
36
38
  },
37
- 'unused-imports': {
38
- rules: unused.rules,
39
- },
40
39
  ...(Object.fromEntries(plugins.map(x => [x.name, x])))
41
40
  },
42
41
  rules: {
@@ -45,7 +44,21 @@ export function buildConfig(pluginMaps: Record<string, TrvEslintPlugin>[]): read
45
44
  }
46
45
  },
47
46
  {
48
- ...RULE_COMMON,
47
+ languageOptions: {
48
+ globals: GLOBALS,
49
+ ecmaVersion: 'latest',
50
+ },
51
+ files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
52
+ plugins: {
53
+ '@stylistic': {
54
+ rules: stylisticPlugin.rules
55
+ }
56
+ },
57
+ rules: {
58
+ ...Object.fromEntries(Object.entries(STD_RULES).filter(x => !x[0].startsWith('@typescript'))),
59
+ }
60
+ },
61
+ {
49
62
  files: ['**/*.ts', '**/*.tsx'],
50
63
  rules: {
51
64
  '@typescript-eslint/explicit-function-return-type': 'warn',
@@ -53,19 +66,14 @@ export function buildConfig(pluginMaps: Record<string, TrvEslintPlugin>[]): read
53
66
  }
54
67
  },
55
68
  {
56
- ...RULE_COMMON,
57
69
  files: ['**/DOC.ts', '**/DOC.tsx', '**/doc/**/*.ts', '**/doc/**/*.tsx'],
58
70
  rules: {
59
71
  'max-len': 0,
60
72
  'no-unused-private-class-members': 0,
61
- '@typescript-eslint/quotes': 'warn',
62
- '@typescript-eslint/indent': 0,
63
- '@typescript-eslint/consistent-type-assertions': 0,
64
73
  '@typescript-eslint/explicit-function-return-type': 0
65
74
  }
66
75
  },
67
76
  {
68
- ...RULE_COMMON,
69
77
  files: [
70
78
  'module/compiler/**/*.ts', 'module/transformer/**/*.ts',
71
79
  '**/support/transformer/**/*.ts', '**/support/transformer/**/*.tsx',
@@ -76,17 +84,14 @@ export function buildConfig(pluginMaps: Record<string, TrvEslintPlugin>[]): read
76
84
  }
77
85
  },
78
86
  {
79
- ...RULE_COMMON,
80
87
  files: ['**/test/**/*.ts', '**/test/**/*.tsx', '**/support/test/**/*.ts', '**/support/test/**/*.tsx'],
81
88
  ignores: [...IGNORES, 'module/test/src/**'],
82
89
  rules: {
83
- '@typescript-eslint/consistent-type-assertions': 0,
84
- 'no-unused-private-class-members': 0,
85
90
  '@typescript-eslint/explicit-function-return-type': 0
86
91
  }
87
92
  },
88
93
  ...extra.map(ex => ({
89
- ...RULE_COMMON,
94
+ ...TS_OPTIONS,
90
95
  ...ex
91
96
  }))
92
97
  ] as const;
@@ -1,6 +1,5 @@
1
1
  export const STD_RULES = {
2
2
  'no-loss-of-precision': 0,
3
- 'unused-imports/no-unused-imports': 'error',
4
3
  'no-unused-vars': 0,
5
4
  'no-dupe-class-members': 0,
6
5
  '@typescript-eslint/array-type': 'error',
@@ -9,7 +8,7 @@ export const STD_RULES = {
9
8
  '@typescript-eslint/no-explicit-any': 'warn',
10
9
  '@typescript-eslint/explicit-member-accessibility': [0, { accessibility: 'explicit' }],
11
10
  indent: 0,
12
- '@typescript-eslint/indent': [
11
+ '@stylistic/indent': [
13
12
  'error',
14
13
  2,
15
14
  {
@@ -24,7 +23,7 @@ export const STD_RULES = {
24
23
  SwitchCase: 1
25
24
  }
26
25
  ],
27
- '@typescript-eslint/member-delimiter-style': [
26
+ '@stylistic/member-delimiter-style': [
28
27
  'error',
29
28
  {
30
29
  multiline: { delimiter: 'semi', requireLast: true },
@@ -65,12 +64,12 @@ export const STD_RULES = {
65
64
  'error',
66
65
  { varsIgnorePattern: '^(_|[A-Z])[A-Za-z0-9]*', args: 'none' }
67
66
  ],
68
- '@typescript-eslint/quotes': [
67
+ '@stylistic/quotes': [
69
68
  'error',
70
69
  'single',
71
70
  { avoidEscape: true, allowTemplateLiterals: false }
72
71
  ],
73
- '@typescript-eslint/semi': [
72
+ '@stylistic/semi': [
74
73
  'error',
75
74
  'always'
76
75
  ],
@@ -83,7 +82,7 @@ export const STD_RULES = {
83
82
  'no-ex-assign': 0,
84
83
  '@typescript-eslint/ban-types': 0,
85
84
  '@typescript-eslint/ban-ts-comment': 0,
86
- '@typescript-eslint/type-annotation-spacing': 'error',
85
+ '@stylistic/type-annotation-spacing': 'error',
87
86
  '@typescript-eslint/explicit-module-boundary-types': 0,
88
87
  'arrow-body-style': ['error', 'as-needed'],
89
88
  '@typescript-eslint/naming-convention': [