Skip to content

Commit

Permalink
chore: switch flat eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
kokororin committed Sep 21, 2024
1 parent 59cf4dc commit 1a6abee
Show file tree
Hide file tree
Showing 12 changed files with 1,232 additions and 1,139 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

66 changes: 0 additions & 66 deletions .eslintrc.cjs

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eslint.useFlatConfig": true
}
91 changes: 91 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import pluginUnicorn from 'eslint-plugin-unicorn';
import pluginImport from 'eslint-plugin-import';
import pluginNode from 'eslint-plugin-n';
import pluginPromise from 'eslint-plugin-promise';
import pluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import { parser, plugin as pluginTs } from 'typescript-eslint';
import configLove from 'eslint-config-love';
import globals from 'globals';

export default [
pluginPrettierRecommended,
{
files: ['**/*.ts', '**/*.js'],
languageOptions: {
parser,
parserOptions: {
project: ['tsconfig.json', 'tsconfig.eslint.json']
},
globals: {
...globals.browser,
...globals.node,
...globals.mocha
}
},
plugins: {
unicorn: pluginUnicorn,
n: pluginNode,
'@typescript-eslint': pluginTs,
promise: pluginPromise,
import: pluginImport
},
rules: {
...configLove.rules,
...pluginImport.flatConfigs.recommended.rules,
'n/no-sync': 'error',
'n/prefer-promises/fs': 'error',
'prettier/prettier': [
'error',
{
endOfLine: 'auto'
}
],
'@typescript-eslint/prefer-nullish-coalescing': [
'error',
{
ignoreConditionalTests: true,
ignoreMixedLogicalExpressions: true
}
],
'@typescript-eslint/strict-boolean-expressions': [
'error',
{
allowString: true,
allowNumber: true,
allowNullableObject: false,
allowNullableBoolean: true,
allowNullableString: true,
allowNullableNumber: true,
allowAny: true
}
],
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/class-methods-use-this': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
'@typescript-eslint/init-declarations': 'off',
'unicorn/prefer-node-protocol': 'error',
'unicorn/catch-error-name': [
'error',
{
name: 'err'
}
]
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx']
},
'import/resolver': {
typescript: {
alwaysTryTypes: true
}
}
}
},
{
ignores: ['node_modules/**', 'dist/**', 'out/**']
}
];
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"pretest": "nr build",
"test": "node ./out/test/runTest.js",
"format": "prettier --write .",
"lint": "eslint --ext .ts,.js --fix src test scripts",
"lint": "eslint --fix src test scripts",
"prepublishOnly": "nr build && vsce publish --no-dependencies"
},
"keywords": [
Expand Down Expand Up @@ -621,7 +621,7 @@
}
},
"devDependencies": {
"@antfu/ni": "^0.21.12",
"@antfu/ni": "^0.23.0",
"@kokororin/prettierrc": "^0.1.1",
"@types/adm-zip": "^0.5.5",
"@types/debug": "^4.1.12",
Expand All @@ -630,32 +630,32 @@
"@types/node": "^18.0.0",
"@types/semver": "^7.5.8",
"@types/vscode": "^1.60.0",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"@vscode/test-electron": "^2.3.9",
"@vscode/vsce": "^2.31.1",
"adm-zip": "^0.5.10",
"consola": "^3.2.3",
"eslint": "^8.57.0",
"eslint-config-love": "^71.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-unicorn": "^53.0.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-n": "^17.10.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.1.0",
"eslint-plugin-unicorn": "^55.0.0",
"fast-glob": "^3.3.2",
"globals": "^15.9.0",
"md5": "^2.3.0",
"mocha": "^10.3.0",
"prettier": "^3.2.5",
"prettier": "^3.3.3",
"read-pkg-up": "^7.0.1",
"rimraf": "^5.0.5",
"semver": "^7.6.0",
"simple-git": "^3.22.0",
"tsup": "^8.0.2",
"tsx": "^4.7.1",
"typescript": "~5.3.0"
"tsup": "^8.3.0",
"tsx": "^4.19.1",
"typescript": "~5.5.0",
"typescript-eslint": "^8.6.0"
},
"dependencies": {
"compare-versions": "^6.1.0",
Expand All @@ -664,10 +664,10 @@
"mem": "^8.1.1",
"phpfmt": "^0.0.7"
},
"packageManager": "pnpm@9.2.0",
"packageManager": "pnpm@9.10.0",
"pnpm": {
"patchedDependencies": {
"phpfmt@0.0.7": "patches/phpfmt@0.0.7.patch"
"phpfmt": "patches/phpfmt.patch"
}
}
}
File renamed without changes.
Loading

0 comments on commit 1a6abee

Please sign in to comment.