85 lines
2.0 KiB
JavaScript
85 lines
2.0 KiB
JavaScript
import js from '@eslint/js';
|
|
import { createRequire } from 'node:module';
|
|
import globals from 'globals';
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
const frontendRequire = createRequire(
|
|
new URL('./packages/frontend/package.json', import.meta.url),
|
|
);
|
|
const reactHooks = frontendRequire('eslint-plugin-react-hooks');
|
|
const reactRefreshModule = frontendRequire('eslint-plugin-react-refresh');
|
|
const reactRefresh = reactRefreshModule.default ?? reactRefreshModule;
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores: [
|
|
'**/node_modules/**',
|
|
'**/.next/**',
|
|
'**/dist/**',
|
|
'**/coverage/**',
|
|
'**/*.d.ts',
|
|
],
|
|
},
|
|
{
|
|
linterOptions: {
|
|
reportUnusedDisableDirectives: 'off',
|
|
},
|
|
},
|
|
js.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
{
|
|
files: [
|
|
'packages/frontend/src/**/*.{ts,tsx,js,jsx}',
|
|
'src/**/*.{ts,tsx,js,jsx}',
|
|
],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.es2021,
|
|
},
|
|
parserOptions: {
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
},
|
|
plugins: {
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh,
|
|
},
|
|
},
|
|
{
|
|
files: [
|
|
'packages/backend/src/**/*.{ts,js}',
|
|
'packages/share/src/**/*.{ts,js}',
|
|
],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.node,
|
|
...globals.jest,
|
|
...globals.es2023,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
rules: {
|
|
'@typescript-eslint/ban-ts-comment': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/no-inferrable-types': 'off',
|
|
'@typescript-eslint/no-require-imports': 'off',
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'warn',
|
|
{
|
|
argsIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_',
|
|
},
|
|
],
|
|
'no-console': 'off',
|
|
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
'@typescript-eslint/no-unused-expressions': 'off',
|
|
'no-undef': 'off',
|
|
'no-unused-vars': 'off',
|
|
},
|
|
},
|
|
);
|