Skip to content

Commit

Permalink
Bump eslint to 9.x (#98)
Browse files Browse the repository at this point in the history
* upgrade eslint

* fix eslint error

* 2.8.3
  • Loading branch information
kbarbounakis authored Nov 2, 2024
1 parent 419451b commit 8d9e03c
Show file tree
Hide file tree
Showing 17 changed files with 1,606 additions and 994 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

41 changes: 0 additions & 41 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jest.setup.js
# eslint
.eslintrc
.eslintignore
eslint.config.mjs

# lib
lib
62 changes: 62 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import globals from 'globals';
import babelParser from '@babel/eslint-parser';
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
import jest from 'eslint-plugin-jest';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: ['**/dist', '**/node_modules'],
}, {
files: ['spec/**'],
...jest.configs['flat/recommended'],
rules: {
...jest.configs['flat/recommended'].rules,
'jest/prefer-expect-assertions': 'off',
},
}, ...compat.extends('eslint:recommended'), {
languageOptions: {
globals: {
...globals.node
},
parser: babelParser,
},
rules: {
'no-console': 'off',
'no-invalid-this': 'warn',
'no-undef': 'error',
'no-unused-vars': 'warn',
'no-var': ['error'],
quotes: ['error', 'single'],
strict: [2, 'never'],
},
}, ...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
).map(config => ({
...config,
files: ['src/**/*.d.ts'],
})), {
files: ['src/**/*.d.ts'],
plugins: {
'@typescript-eslint': typescriptPlugin,
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
languageOptions: {
parser: tsParser,
},
}];
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable quotes */
/**
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
Expand Down
Loading

0 comments on commit 8d9e03c

Please sign in to comment.