Skip to content

Commit

Permalink
chore: migrate ESLint configs to flat config (#14094)
Browse files Browse the repository at this point in the history
* chore: migrate ESLint configs to flat config

* fix: update paths

* fix: frontend lint fails

* refactor(misskey-js): lint build.js
  • Loading branch information
zyoshoka authored Jul 2, 2024
1 parent aa55b59 commit e49182a
Show file tree
Hide file tree
Showing 39 changed files with 496 additions and 691 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ on:
- packages/frontend/**
- packages/sw/**
- packages/misskey-js/**
- packages/shared/.eslintrc.js
- packages/shared/eslint.config.js
pull_request:
paths:
- packages/backend/**
- packages/frontend/**
- packages/sw/**
- packages/misskey-js/**
- packages/shared/.eslintrc.js
- packages/shared/eslint.config.js

jobs:
pnpm_install:
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@
"glob": "10.3.12"
},
"devDependencies": {
"@misskey-dev/eslint-plugin": "2.0.2",
"@types/node": "20.14.7",
"@typescript-eslint/eslint-plugin": "7.13.1",
"@typescript-eslint/parser": "7.13.1",
"cross-env": "7.0.3",
"cypress": "13.12.0",
"eslint": "9.5.0",
"globals": "15.6.0",
"ncp": "2.0.0",
"start-server-and-test": "2.0.4"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/backend/.eslintignore

This file was deleted.

32 changes: 0 additions & 32 deletions packages/backend/.eslintrc.cjs

This file was deleted.

46 changes: 46 additions & 0 deletions packages/backend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import tsParser from '@typescript-eslint/parser';
import sharedConfig from '../shared/eslint.config.js';

export default [
...sharedConfig,
{
ignores: ['**/node_modules', 'built', '@types/**/*'],
},
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parserOptions: {
parser: tsParser,
project: ['./tsconfig.json', './test/tsconfig.json'],
sourceType: 'module',
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'import/order': ['warn', {
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
],
pathGroups: [{
pattern: '@/**',
group: 'external',
position: 'after',
}],
}],
'no-restricted-globals': ['error', {
name: '__dirname',
message: 'Not in ESModule. Use `import.meta.url` instead.',
}, {
name: '__filename',
message: 'Not in ESModule. Use `import.meta.url` instead.',
}],
},
},
];
2 changes: 0 additions & 2 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@
},
"devDependencies": {
"@jest/globals": "29.7.0",
"@misskey-dev/eslint-plugin": "1.0.0",
"@nestjs/platform-express": "10.3.9",
"@simplewebauthn/types": "10.0.0",
"@swc/jest": "0.2.36",
Expand Down Expand Up @@ -231,7 +230,6 @@
"@typescript-eslint/parser": "7.13.1",
"aws-sdk-client-mock": "4.0.1",
"cross-env": "7.0.3",
"eslint": "9.5.0",
"eslint-plugin-import": "2.29.1",
"execa": "9.2.0",
"fkill": "9.0.0",
Expand Down
32 changes: 0 additions & 32 deletions packages/backend/test-server/.eslintrc.cjs

This file was deleted.

43 changes: 43 additions & 0 deletions packages/backend/test-server/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import tsParser from '@typescript-eslint/parser';
import sharedConfig from '../../shared/eslint.config.js';

export default [
...sharedConfig,
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parserOptions: {
parser: tsParser,
project: ['./tsconfig.json'],
sourceType: 'module',
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'import/order': ['warn', {
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
],
pathGroups: [{
pattern: '@/**',
group: 'external',
position: 'after',
}],
}],
'no-restricted-globals': ['error', {
name: '__dirname',
message: 'Not in ESModule. Use `import.meta.url` instead.',
}, {
name: '__filename',
message: 'Not in ESModule. Use `import.meta.url` instead.',
}],
},
},
];
11 changes: 0 additions & 11 deletions packages/backend/test/.eslintrc.cjs

This file was deleted.

22 changes: 22 additions & 0 deletions packages/backend/test/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import sharedConfig from '../../shared/eslint.config.js';

export default [
...sharedConfig,
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
globals: {
...globals.node,
...globals.jest,
},
parserOptions: {
parser: tsParser,
project: ['./tsconfig.json'],
sourceType: 'module',
tsconfigRootDir: import.meta.dirname,
},
},
},
];
82 changes: 0 additions & 82 deletions packages/frontend/.eslintrc.cjs

This file was deleted.

Loading

0 comments on commit e49182a

Please sign in to comment.