mirror of
https://github.com/dorny/paths-filter.git
synced 2024-11-12 08:38:35 +00:00
Upgrade eslint
This commit is contained in:
parent
f81aac8ad0
commit
00461c6632
@ -1,3 +0,0 @@
|
||||
dist/
|
||||
lib/
|
||||
node_modules/
|
@ -1,52 +0,0 @@
|
||||
{
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"extends": ["plugin:github/internal"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
"sourceType": "module",
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"rules": {
|
||||
"eslint-comments/no-use": "off",
|
||||
"import/no-namespace": "off",
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": "error",
|
||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/array-type": "error",
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"camelcase": "off",
|
||||
"@typescript-eslint/camelcase": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
||||
"@typescript-eslint/no-array-constructor": "error",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-extraneous-class": "error",
|
||||
"@typescript-eslint/no-for-in-array": "error",
|
||||
"@typescript-eslint/no-inferrable-types": "error",
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-useless-constructor": "error",
|
||||
"@typescript-eslint/no-var-requires": "error",
|
||||
"@typescript-eslint/prefer-for-of": "warn",
|
||||
"@typescript-eslint/prefer-function-type": "warn",
|
||||
"@typescript-eslint/prefer-includes": "error",
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||
"@typescript-eslint/promise-function-async": ["error", { "allowAny": true }],
|
||||
"@typescript-eslint/require-array-sort-compare": "error",
|
||||
"@typescript-eslint/restrict-plus-operands": "error",
|
||||
"semi": "off",
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/unbound-method": "error"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
}
|
||||
}
|
98
eslint.config.mjs
Normal file
98
eslint.config.mjs
Normal file
@ -0,0 +1,98 @@
|
||||
// @ts-check
|
||||
|
||||
import {fixupPluginRules} from '@eslint/compat'
|
||||
import {FlatCompat} from '@eslint/eslintrc'
|
||||
import jsEslint from '@eslint/js'
|
||||
import eslintConfigPrettier from 'eslint-config-prettier'
|
||||
import tsEslint from 'typescript-eslint'
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: import.meta.dirname,
|
||||
recommendedConfig: jsEslint.configs.recommended,
|
||||
allConfig: jsEslint.configs.all
|
||||
})
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
/**
|
||||
* @param {string} name the pugin name
|
||||
* @param {string} alias the plugin alias
|
||||
* @returns {import("eslint").ESLint.Plugin}
|
||||
*/
|
||||
function legacyPlugin(name, alias = name) {
|
||||
const plugin = compat.plugins(name)[0]?.plugins?.[alias]
|
||||
|
||||
if (!plugin) {
|
||||
throw new Error(`Unable to resolve plugin ${name} and/or alias ${alias}`)
|
||||
}
|
||||
|
||||
return fixupPluginRules(plugin)
|
||||
}
|
||||
/* eslint-enable @typescript-eslint/explicit-function-return-type */
|
||||
|
||||
export default tsEslint.config(
|
||||
jsEslint.configs.recommended,
|
||||
...tsEslint.configs.strictTypeChecked,
|
||||
...tsEslint.configs.stylisticTypeChecked,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: {
|
||||
allowDefaultProject: ['*.js', '*.mjs']
|
||||
},
|
||||
tsconfigRootDir: import.meta.dirname
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
ignores: ['coverage', 'dist', 'lib']
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
github: legacyPlugin('eslint-plugin-github', 'github'), // pending https://github.com/github/eslint-plugin-github/issues/513
|
||||
import: legacyPlugin('eslint-plugin-import', 'import') // Needed for above
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/await-thenable': 'warn',
|
||||
'@typescript-eslint/explicit-function-return-type': 'warn',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-floating-promises': ['warn', {ignoreIIFE: true, ignoreVoid: false}],
|
||||
'@typescript-eslint/no-shadow': 'error',
|
||||
'@typescript-eslint/no-unused-vars': ['warn', {argsIgnorePattern: '^_'}],
|
||||
'@typescript-eslint/restrict-template-expressions': [
|
||||
'error',
|
||||
{
|
||||
allowNever: true,
|
||||
allowNumber: true
|
||||
}
|
||||
],
|
||||
'github/array-foreach': 'error',
|
||||
'github/no-implicit-buggy-globals': 'error',
|
||||
'github/no-then': 'error',
|
||||
'github/no-dynamic-script-tag': 'error',
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
devDependencies: true,
|
||||
optionalDependencies: true,
|
||||
peerDependencies: true
|
||||
}
|
||||
],
|
||||
'import/order': ['warn', {'newlines-between': 'always', alphabetize: {order: 'asc'}}],
|
||||
'no-console': ['warn']
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.test.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'off'
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.js', '**/*.mjs'],
|
||||
...tsEslint.configs.disableTypeChecked
|
||||
},
|
||||
eslintConfigPrettier
|
||||
)
|
27
package.json
27
package.json
@ -5,14 +5,14 @@
|
||||
"description": "Execute your workflow steps only if relevant files are modified.",
|
||||
"main": "lib/main.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"tscheck": "tsc --noEmit",
|
||||
"build": "tsc -b tsconfig.build.json",
|
||||
"tscheck": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"lint": "eslint src/**/*.ts",
|
||||
"lint": "eslint",
|
||||
"pack": "ncc build -m",
|
||||
"test": "vitest",
|
||||
"all": "pnpm run build && pnpm run format && pnpm run lint && pnpm run pack && pnpm test"
|
||||
"all": "pnpm run build && pnpm run tscheck && pnpm run lint && pnpm run format && pnpm run pack && pnpm test run"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -33,18 +33,25 @@
|
||||
"micromatch": "^4.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/webhooks-types": "^7.3.1",
|
||||
"@eslint/compat": "^1.1.1",
|
||||
"@eslint/eslintrc": "^3.1.0",
|
||||
"@eslint/js": "^9.10.0",
|
||||
"@octokit/webhooks-types": "^7.5.1",
|
||||
"@tsconfig/node20": "^20.1.2",
|
||||
"@types/eslint__js": "^8.42.3",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/micromatch": "^4.0.2",
|
||||
"@types/node": "^20.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
||||
"@typescript-eslint/parser": "^6.20.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.5.0",
|
||||
"@typescript-eslint/parser": "^8.5.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-github": "^4.10.1",
|
||||
"prettier": "^3.2.4",
|
||||
"eslint": "^9.10.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-plugin-github": "^5.0.1",
|
||||
"prettier": "^3.3.3",
|
||||
"typescript": "^5.3.3",
|
||||
"typescript-eslint": "^8.5.0",
|
||||
"vitest": "^2.0.5"
|
||||
},
|
||||
"volta": {
|
||||
|
797
pnpm-lock.yaml
797
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
10
tsconfig.build.json
Normal file
10
tsconfig.build.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
|
||||
"outDir": "./lib" /* Redirect output structure to the directory. */,
|
||||
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
{
|
||||
"extends": "@tsconfig/node20/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
"noEmit": true
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user