Replace the primary lint pipeline with oxlint and oxlint-tsgolint for type-aware TypeScript rules, preserving existing rule behavior from eslint.config.mjs via @oxlint/migrate and targeted jsPlugins (@stylistic/eslint-plugin, eslint-plugin-jsdoc as jsdoc-js, oxlint-plugin-eslint for no-restricted-syntax and object-curly-spacing). Keep a hybrid ESLint pass (eslint.config.naming.mjs) only for @typescript-eslint/naming-convention until tsgolint implements it (oxc-project/tsgolint#186). Legacy eslint.config.mjs and eslint.config.typings.mjs remain for reference but are no longer used by npm scripts. Add .oxlintrc.json for src/addons/demo/test and .oxlintrc.typings.json for typings/ (syntax-only, no --type-aware). Update lint, lint-fix, lint-api, and lint-changes to run oxlint first, then naming ESLint. Platform binaries install via oxlint-tsgolint optionalDependencies on Linux, macOS, and Windows. Fixes https://github.com/xtermjs/xterm.js/issues/5690 Co-authored-by: Cursor <cursoragent@cursor.com>
72 lines
2.3 KiB
JavaScript
72 lines
2.3 KiB
JavaScript
// @ts-check
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
const ignores = [
|
|
'addons/*/src/third-party/*.ts',
|
|
'**/out/*',
|
|
'**/out-test/*',
|
|
'**/out-esbuild/*',
|
|
'**/out-esbuild-test/*',
|
|
'**/inwasm-sdks/*',
|
|
'**/node_modules',
|
|
'**/*.js',
|
|
'**/*.mjs'
|
|
];
|
|
|
|
const namingConventionMain = [
|
|
'warn',
|
|
{ selector: 'default', format: ['camelCase'], filter: { regex: '^[a-z]', match: true } },
|
|
{ selector: 'variable', format: ['camelCase', 'UPPER_CASE'] },
|
|
{ selector: 'variable', filter: '^I.+Service$', format: ['PascalCase'], prefix: ['I'] },
|
|
{ selector: 'memberLike', modifiers: ['private'], format: ['camelCase'], leadingUnderscore: 'require' },
|
|
{ selector: 'memberLike', modifiers: ['protected'], format: ['camelCase'], leadingUnderscore: 'require' },
|
|
{ selector: 'enumMember', format: ['UPPER_CASE'] },
|
|
{ selector: 'property', modifiers: ['public'], format: ['camelCase', 'UPPER_CASE'], filter: { regex: '^[a-z]', match: true } },
|
|
{ selector: 'method', modifiers: ['public'], format: ['camelCase', 'UPPER_CASE'], custom: { regex: '^on[A-Z].+', match: false } },
|
|
{ selector: 'method', modifiers: ['private'], format: ['camelCase'], leadingUnderscore: 'require', custom: { regex: '^on[A-Z].+', match: false } },
|
|
{ selector: 'method', modifiers: ['protected'], format: ['camelCase'], leadingUnderscore: 'require', custom: { regex: '^on[A-Z].+', match: false } },
|
|
{ selector: 'typeLike', format: ['PascalCase'] },
|
|
{ selector: 'interface', format: ['PascalCase'], prefix: ['I'] }
|
|
];
|
|
|
|
const namingConventionTypings = [
|
|
'warn',
|
|
{ selector: 'typeLike', format: ['PascalCase'] },
|
|
{ selector: 'interface', format: ['PascalCase'], prefix: ['I'] }
|
|
];
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores
|
|
},
|
|
{
|
|
files: ['**/*.ts'],
|
|
ignores: ['typings/**/*.d.ts', 'addons/**/typings/**'],
|
|
plugins: {
|
|
'@typescript-eslint': tseslint.plugin
|
|
},
|
|
languageOptions: {
|
|
parser: tseslint.parser,
|
|
parserOptions: {
|
|
projectService: true,
|
|
tsconfigRootDir: import.meta.dirname
|
|
}
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/naming-convention': namingConventionMain
|
|
}
|
|
},
|
|
{
|
|
files: ['typings/**/*.d.ts'],
|
|
plugins: {
|
|
'@typescript-eslint': tseslint.plugin
|
|
},
|
|
languageOptions: {
|
|
parser: tseslint.parser
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/naming-convention': namingConventionTypings
|
|
}
|
|
}
|
|
);
|