Skip to content

Commit afbcd12

Browse files
committed
better lint rules, consolodation of babel and tsc configs, updated dep
1 parent 9d411fa commit afbcd12

File tree

15 files changed

+795
-246
lines changed

15 files changed

+795
-246
lines changed

babel.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
export default {
22
presets: [
3-
['@babel/preset-env', { targets: { node: 'current' } }],
3+
['@babel/preset-env', {
4+
targets: {
5+
browsers: ['> 1%', 'last 3 versions', 'not dead']
6+
}
7+
}],
48
'@babel/preset-typescript',
59
],
610
plugins: [

eslint.config.mjs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import tseslintPlugin from '@typescript-eslint/eslint-plugin'
21
import globals from 'globals'
32
import tsParser from '@typescript-eslint/parser'
43
import neostandard from 'neostandard'
@@ -29,21 +28,30 @@ export default [
2928
...globals.node,
3029
Atomics: 'readonly',
3130
SharedArrayBuffer: 'readonly',
32-
}
31+
},
32+
ecmaVersion: 2022, // Support class fields and other modern syntax
33+
sourceType: 'module' // Match TypeScript module: ESNext
3334
},
3435
rules: {
36+
// Code style - match TypeScript settings
3537
semi: ['error', 'never'],
3638
quotes: ['error', 'single'],
39+
40+
// Strict checking - match TypeScript strictness
3741
'no-console': 'error',
38-
'no-unused-vars': 'error',
39-
'no-undef': 'error'
42+
'no-unused-vars': 'error', // Match TypeScript noUnusedLocals: true
43+
'no-undef': 'error',
44+
strict: ['error', 'global'], // Match TypeScript alwaysStrict: true
45+
46+
// Additional strictness to match TypeScript behavior
47+
'no-implicit-globals': 'error',
48+
'prefer-const': 'error', // Encourage immutability
49+
'no-var': 'error', // Use let/const only
50+
'no-redeclare': 'error'
4051
},
4152
},
4253
{
4354
files: ['src/**/*.ts'],
44-
plugins: {
45-
'@typescript-eslint': tseslintPlugin,
46-
},
4755

4856
languageOptions: {
4957
globals: {
@@ -60,21 +68,13 @@ export default [
6068
rules: {
6169
semi: ['error', 'never'],
6270
quotes: ['error', 'single'],
63-
'no-console': 'error',
64-
'no-unused-vars': 'off',
65-
'@typescript-eslint/no-unused-vars': ['warn', {
66-
argsIgnorePattern: '^_',
67-
varsIgnorePattern: '^_',
68-
caughtErrorsIgnorePattern: '^_',
69-
}],
70-
// '@typescript-eslint/no-explicit-any': 'warn', - codebase not ready for this
71+
// Disable ESLint rules that TypeScript handles better
72+
'no-unused-vars': 'off', // TypeScript handles this via noUnusedLocals
73+
'no-undef': 'off', // TypeScript handles undefined variables
7174
},
7275
},
7376
{
7477
files: ['test/**/*.ts'],
75-
plugins: {
76-
'@typescript-eslint': tseslintPlugin,
77-
},
7878
languageOptions: {
7979
parser: tsParser,
8080
parserOptions: {
@@ -84,8 +84,9 @@ export default [
8484
rules: {
8585
semi: ['error', 'never'],
8686
quotes: ['error', 'single'],
87-
'no-console': 'off', // Allow console in tests
88-
'no-undef': 'off', // Tests may define globals
87+
// Disable ESLint rules that TypeScript handles better
88+
'no-unused-vars': 'off', // TypeScript handles this via noUnusedLocals
89+
'no-undef': 'off', // TypeScript handles undefined variables
8990
}
9091
},
9192
{

0 commit comments

Comments
 (0)