Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra: migrate to eslint@9 #2973

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

67 changes: 0 additions & 67 deletions .eslintrc

This file was deleted.

4 changes: 2 additions & 2 deletions .mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function getRequire() {
'experimental-loader',
];

for (const package of packages) {
packagesSet.add(dirname(require.resolve(`@stylable/${package}/package.json`)));
for (const packageName of packages) {
packagesSet.add(dirname(require.resolve(`@stylable/${packageName}/package.json`)));
}

// we get this env variable from ./.vscode/launch.json (f5 - Mocha Current)
Expand Down
55 changes: 55 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import pluginJs from '@eslint/js';
import configPrettier from 'eslint-config-prettier';
import pluginTypescript from 'typescript-eslint';

for (const config of pluginTypescript.configs.recommendedTypeChecked) {
config.files = ['**/*.{ts,tsx,mts,cts}']; // ensure config only targets TypeScript files
}

/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: [
'**/dist/',
'**/esm/',
'packages/create-stylable-app/typings/template.d.ts',
'packages/language-service/test/fixtures/server-cases/mixins/',
'packages/runtime/stylesheet.d.ts',
],
},
pluginJs.configs.recommended,
{
rules: {
'no-console': 'off',
'no-undef': 'off',
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
},
},
...pluginTypescript.configs.recommendedTypeChecked,
{ languageOptions: { parserOptions: { projectService: true } } },
{
files: ['**/*.{ts,tsx,mts,cts}'],
rules: {
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-require-imports': 'off',

'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',

'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/unbound-method': 'off',
},
},
configPrettier,
];
Loading