Merge pull request #252 from oke-py/refactor/update-eslint-config
refactor: update eslint configuration to match typescript-action template
This commit is contained in:
@@ -1,26 +0,0 @@
|
|||||||
import github from "eslint-plugin-github";
|
|
||||||
|
|
||||||
export default [
|
|
||||||
github.getFlatConfigs().recommended,
|
|
||||||
...github.getFlatConfigs().typescript,
|
|
||||||
{
|
|
||||||
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
|
|
||||||
ignores: ["eslint.config.mjs"],
|
|
||||||
rules: {
|
|
||||||
"github/array-foreach": "error",
|
|
||||||
"github/async-preventdefault": "warn",
|
|
||||||
"github/no-then": "error",
|
|
||||||
"github/no-blur": "error",
|
|
||||||
'i18n-text/no-en': 'off',
|
|
||||||
'import/no-unresolved': 'off',
|
|
||||||
'import/no-namespace': 'off',
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
'import/resolver': {
|
|
||||||
typescript: {
|
|
||||||
project: './tsconfig.json',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
86
eslint.config.mjs
Normal file
86
eslint.config.mjs
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
// See: https://eslint.org/docs/latest/use/configure/configuration-files
|
||||||
|
|
||||||
|
import { fixupPluginRules } from '@eslint/compat'
|
||||||
|
import { FlatCompat } from '@eslint/eslintrc'
|
||||||
|
import js from '@eslint/js'
|
||||||
|
import typescriptEslint from '@typescript-eslint/eslint-plugin'
|
||||||
|
import tsParser from '@typescript-eslint/parser'
|
||||||
|
import _import from 'eslint-plugin-import'
|
||||||
|
import prettier from 'eslint-plugin-prettier'
|
||||||
|
import globals from 'globals'
|
||||||
|
import path from 'node:path'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
|
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: [
|
||||||
|
'**/coverage',
|
||||||
|
'**/dist',
|
||||||
|
'**/linter',
|
||||||
|
'**/node_modules',
|
||||||
|
'**/lib'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
...compat.extends(
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:@typescript-eslint/eslint-recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:prettier/recommended'
|
||||||
|
),
|
||||||
|
{
|
||||||
|
plugins: {
|
||||||
|
import: fixupPluginRules(_import),
|
||||||
|
prettier,
|
||||||
|
'@typescript-eslint': typescriptEslint
|
||||||
|
},
|
||||||
|
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
Atomics: 'readonly',
|
||||||
|
SharedArrayBuffer: 'readonly'
|
||||||
|
},
|
||||||
|
|
||||||
|
parser: tsParser,
|
||||||
|
ecmaVersion: 2023,
|
||||||
|
sourceType: 'module',
|
||||||
|
|
||||||
|
parserOptions: {
|
||||||
|
project: ['tsconfig.eslint.json'],
|
||||||
|
tsconfigRootDir: '.'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
settings: {
|
||||||
|
'import/resolver': {
|
||||||
|
typescript: {
|
||||||
|
alwaysTryTypes: true,
|
||||||
|
project: 'tsconfig.eslint.json'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
camelcase: 'off',
|
||||||
|
'eslint-comments/no-use': 'off',
|
||||||
|
'eslint-comments/no-unused-disable': 'off',
|
||||||
|
'i18n-text/no-en': 'off',
|
||||||
|
'import/no-namespace': 'off',
|
||||||
|
'import/no-unresolved': 'off',
|
||||||
|
'no-console': 'off',
|
||||||
|
'no-shadow': 'off',
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'warn',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'warn',
|
||||||
|
'prettier/prettier': 'error'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
808
package-lock.json
generated
808
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@@ -15,7 +15,7 @@
|
|||||||
"bundle": "npm run format:write && npm run package",
|
"bundle": "npm run format:write && npm run package",
|
||||||
"format:write": "npx prettier --write .",
|
"format:write": "npx prettier --write .",
|
||||||
"format:check": "npx prettier --check .",
|
"format:check": "npx prettier --check .",
|
||||||
"lint": "eslint src/**/*.ts",
|
"lint": "npx eslint .",
|
||||||
"package": "npx rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
|
"package": "npx rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
|
||||||
"test": "vitest --run",
|
"test": "vitest --run",
|
||||||
"test:coverage": "vitest --run --coverage",
|
"test:coverage": "vitest --run --coverage",
|
||||||
@@ -40,6 +40,9 @@
|
|||||||
"strip-ansi": "^7.1.0"
|
"strip-ansi": "^7.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/compat": "^1.2.9",
|
||||||
|
"@eslint/eslintrc": "^3.3.1",
|
||||||
|
"@eslint/js": "^9.26.0",
|
||||||
"@rollup/plugin-commonjs": "^25.0.0",
|
"@rollup/plugin-commonjs": "^25.0.0",
|
||||||
"@rollup/plugin-node-resolve": "^15.0.0",
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
||||||
"@rollup/plugin-typescript": "^12.1.2",
|
"@rollup/plugin-typescript": "^12.1.2",
|
||||||
@@ -48,9 +51,11 @@
|
|||||||
"@typescript-eslint/parser": "^8.31.1",
|
"@typescript-eslint/parser": "^8.31.1",
|
||||||
"@vitest/coverage-v8": "^3.1.2",
|
"@vitest/coverage-v8": "^3.1.2",
|
||||||
"eslint": "^9.26.0",
|
"eslint": "^9.26.0",
|
||||||
"eslint-define-config": "^2.1.0",
|
"eslint-config-prettier": "^10.1.2",
|
||||||
"eslint-import-resolver-typescript": "^4.3.4",
|
"eslint-import-resolver-typescript": "^4.3.4",
|
||||||
"eslint-plugin-github": "^6.0.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
|
"eslint-plugin-prettier": "^5.4.0",
|
||||||
|
"globals": "^16.0.0",
|
||||||
"js-yaml": "^4.0.0",
|
"js-yaml": "^4.0.0",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"rollup": "^3.0.0",
|
"rollup": "^3.0.0",
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"__tests__",
|
"__tests__",
|
||||||
"src",
|
"src",
|
||||||
"eslint.config.js",
|
"eslint.config.mjs",
|
||||||
"rollup.config.ts"
|
"rollup.config.ts",
|
||||||
|
"vitest.config.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user