mirror of
https://github.com/actions/setup-java.git
synced 2026-06-23 08:10:30 +03:00
af5f874769
Upgrade ESLint from 8.57.0 to 10.5.0. ESLint 10 removes support for the legacy `.eslintrc` format entirely, so the configuration is migrated to the new flat config (`eslint.config.mjs`). Changes: - Bump `eslint` 8.57.0 -> 10.5.0 and `eslint-plugin-jest` to 29.15.2. - Replace the legacy `@typescript-eslint/eslint-plugin` + `@typescript-eslint/parser` pair with the `typescript-eslint` meta-package (8.62.0), which supports ESLint 10. - Replace the deprecated `eslint-plugin-node` (unmaintained, broken on ESLint 9+) with its maintained fork `eslint-plugin-n` (18.1.0); the single rule in use, `node/no-extraneous-import`, becomes `n/no-extraneous-import`. - Add `@eslint/js` (10.0.1) and `globals` (17.7.0), now required by flat config. - Translate `.eslintrc.js` to `eslint.config.mjs` and `.eslintignore` to the flat config `ignores`, preserving all existing rules and the test-file overrides. - Update the `lint`/`lint:fix` scripts to invoke `eslint` directly (flat config is auto-detected; the `--config ./.eslintrc.js` flag is removed). `preserve-caught-error` (new in ESLint 10's recommended set) is disabled to keep the previous lint behavior; adopting it requires an ES2022 target and is left as a follow-up. Only dev/lint dependencies change, so runtime deps and the built `dist/` output are unchanged. Note: `.eslintrc.js` was previously auto-synced from actions/reusable-workflows. Upstream has not yet published a flat config, so this migration intentionally deviates from that auto-sync until upstream catches up. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
import js from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import jestPlugin from 'eslint-plugin-jest';
|
|
import nodePlugin from 'eslint-plugin-n';
|
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
import globals from 'globals';
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores: [
|
|
'dist/',
|
|
'lib/',
|
|
'node_modules/',
|
|
'coverage/',
|
|
'**/*.js',
|
|
'**/*.cjs',
|
|
'**/*.mjs',
|
|
'**/*.d.ts'
|
|
]
|
|
},
|
|
{
|
|
files: ['src/**/*.ts', '__tests__/**/*.ts'],
|
|
extends: [
|
|
js.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
jestPlugin.configs['flat/recommended'],
|
|
eslintConfigPrettier
|
|
],
|
|
plugins: {
|
|
n: nodePlugin
|
|
},
|
|
languageOptions: {
|
|
ecmaVersion: 2021,
|
|
sourceType: 'module',
|
|
globals: {
|
|
...globals.node,
|
|
...globals.es2021
|
|
}
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/no-require-imports': 'error',
|
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/no-empty-function': 'off',
|
|
'@typescript-eslint/ban-ts-comment': [
|
|
'error',
|
|
{
|
|
'ts-ignore': 'allow-with-description'
|
|
}
|
|
],
|
|
'no-console': 'error',
|
|
yoda: 'error',
|
|
'prefer-const': [
|
|
'error',
|
|
{
|
|
destructuring: 'all'
|
|
}
|
|
],
|
|
'no-control-regex': 'off',
|
|
'no-constant-condition': ['error', {checkLoops: false}],
|
|
// ESLint 10's recommended set adds `preserve-caught-error`, which the
|
|
// previous ESLint 8 recommended config did not enable. Keep it off to
|
|
// preserve the prior lint behavior; adopting it would require attaching
|
|
// an Error `cause` (ES2022) and is out of scope for this upgrade.
|
|
'preserve-caught-error': 'off',
|
|
'n/no-extraneous-import': 'error'
|
|
}
|
|
},
|
|
{
|
|
files: ['**/*{test,spec}.ts'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.jest
|
|
}
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
'jest/no-standalone-expect': 'off',
|
|
'jest/no-conditional-expect': 'off',
|
|
'no-console': 'off'
|
|
}
|
|
}
|
|
);
|