Skip to content

Commit

Permalink
merge pull request #9
Browse files Browse the repository at this point in the history
Modernize ESLint and typescript-eslint
  • Loading branch information
Nipheris authored May 2, 2024
2 parents 476253e + c638d0e commit 3935861
Show file tree
Hide file tree
Showing 9 changed files with 390 additions and 321 deletions.
52 changes: 37 additions & 15 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// @ts-check

import gitIgnore from 'eslint-config-flat-gitignore';
import tsParser from '@typescript-eslint/parser';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import js from '@eslint/js';
import ts from 'typescript-eslint';

export default [
'eslint:all',
// 'plugin:@typescript-eslint/recommended',
export default ts.config(
// @ts-expect-error bad type inference for exported members of @eslint/js
js.configs.all,
...ts.configs.recommendedTypeChecked,
gitIgnore(),
{
rules: {
Expand Down Expand Up @@ -53,24 +56,43 @@ export default [
},
{
files: [
'**/*.ts',
'**/*.cts',
'**/*.mts',
'**/*.mjs',
],
languageOptions: {
ecmaVersion: 2022,
parser: tsParser,
},
plugins: {
'@typescript-eslint': tsPlugin,
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-use-before-define': ['error', 'nofunc'],
},
},
];
// disable type-checked rules for non-TS files
{
files: [
'**/*.cjs',
'**/*.mjs',
],
languageOptions: {
globals: {
process: 'readonly',
console: 'readonly',
},
},
extends: [ts.configs.disableTypeChecked],
},
// workaround for a too broad sourceType setting in base config:
// https://github.com/typescript-eslint/typescript-eslint/blob/v7.6.0/packages/typescript-eslint/src/configs/base.ts#L10
{
files: [
'**/*.cjs',
],
languageOptions: {
sourceType: 'commonjs',
},
},
);
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@
"jewelcase": "./dist/cli.mjs"
},
"devDependencies": {
"@eslint/js": "^8.57.0",
"@jest/globals": "^29.3.1",
"@tsconfig/esm": "^1.0.2",
"@tsconfig/node18": "^2.0.0",
"@tsconfig/node20": "^20.1.4",
"@tsconfig/strictest": "^2.0.0",
"@types/ini": "^1.3.31",
"@types/node": "18.13.0",
"@types/node": "20.12.7",
"@types/tar": "^6.1.4",
"@types/yargs": "^17.0.16",
"@typescript-eslint/eslint-plugin": "^5.45.1",
"@typescript-eslint/parser": "^5.45.1",
"editorconfig-checker": "^4.0.2",
"eslint": "^8.29.0",
"eslint": "^8.57.0",
"eslint-config-flat-gitignore": "^0.1.3",
"husky": "^8.0.0",
"jest": "^29.3.1",
"lint-staged": "^13.0.4",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
"typescript": "^5.0.4",
"typescript-eslint": "^7.7.0"
},
"engines": {
"node": ">=18.13.0"
"node": ">=20.12.0"
},
"packageManager": "pnpm@8.3.1",
"private": true,
Expand All @@ -44,7 +44,7 @@
"tests:start": "pnpm --filter ./tests start"
},
"volta": {
"node": "18.13.0",
"node": "20.12.0",
"pnpm": "8.3.1"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 3935861

Please sign in to comment.