Skip to content

Commit

Permalink
infra: migrate to eslint@9
Browse files Browse the repository at this point in the history
adjust rule tests to new RuleTester behavior
replaced usages of deprecated APIs
  • Loading branch information
AviVahl committed Aug 30, 2024
1 parent 4d40e09 commit 64a0709
Show file tree
Hide file tree
Showing 14 changed files with 281 additions and 356 deletions.
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

0 comments on commit 64a0709

Please sign in to comment.