2020-12-24 16:49:43 +03:30
|
|
|
module.exports = {
|
2023-02-06 10:06:33 +01:00
|
|
|
extends: ['airbnb', 'airbnb-typescript', 'prettier'],
|
2024-04-14 15:50:12 +02:00
|
|
|
plugins: [
|
|
|
|
|
'unused-imports',
|
|
|
|
|
'eslint-plugin-import',
|
|
|
|
|
'@typescript-eslint',
|
|
|
|
|
'no-relative-import-paths',
|
|
|
|
|
'prettier',
|
|
|
|
|
'header',
|
|
|
|
|
],
|
2020-12-24 17:19:49 +03:30
|
|
|
parserOptions: {
|
2023-07-09 00:06:52 +02:00
|
|
|
project: ['./tsconfig.json', './tsconfig.node.json', './tools/scripts/tsconfig.json'],
|
2020-12-24 17:19:49 +03:30
|
|
|
},
|
2023-08-11 17:23:56 +02:00
|
|
|
overrides: [
|
|
|
|
|
{
|
|
|
|
|
files: ['*'],
|
|
|
|
|
rules: {
|
2023-10-27 21:19:45 +02:00
|
|
|
'unused-imports/no-unused-imports': 'error',
|
|
|
|
|
|
2023-10-28 00:32:02 +02:00
|
|
|
'import/prefer-default-export': 'off',
|
|
|
|
|
'import/no-default-export': 'error',
|
|
|
|
|
|
2023-08-11 17:23:56 +02:00
|
|
|
'header/header': [
|
|
|
|
|
'error',
|
|
|
|
|
'block', // comment type
|
|
|
|
|
[
|
|
|
|
|
// expected file header comment
|
|
|
|
|
// the spaces are important, otherwise, the rule will mark it as an error
|
|
|
|
|
'',
|
|
|
|
|
' * Copyright (C) Contributors to the Suwayomi project',
|
|
|
|
|
' *',
|
|
|
|
|
' * This Source Code Form is subject to the terms of the Mozilla Public',
|
|
|
|
|
' * License, v. 2.0. If a copy of the MPL was not distributed with this',
|
|
|
|
|
' * file, You can obtain one at https://mozilla.org/MPL/2.0/.',
|
|
|
|
|
' ',
|
|
|
|
|
],
|
|
|
|
|
2, // number of new lines after comment
|
|
|
|
|
],
|
2023-05-18 13:17:41 +02:00
|
|
|
|
2023-08-11 17:23:56 +02:00
|
|
|
'prettier/prettier': 'error',
|
2021-09-09 17:51:22 +04:30
|
|
|
|
2023-08-15 14:39:45 +02:00
|
|
|
'class-methods-use-this': 'off',
|
|
|
|
|
|
2023-08-11 17:23:56 +02:00
|
|
|
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
2021-09-09 17:51:22 +04:30
|
|
|
|
2023-08-11 17:23:56 +02:00
|
|
|
// just why
|
2023-08-15 22:20:24 +02:00
|
|
|
'react/jsx-uses-react': 'off',
|
|
|
|
|
'react/react-in-jsx-scope': 'off',
|
2023-08-11 17:23:56 +02:00
|
|
|
'react/jsx-no-bind': 'off',
|
|
|
|
|
'react/jsx-props-no-spreading': 'off',
|
|
|
|
|
'react/require-default-props': 'off',
|
|
|
|
|
'react/function-component-definition': 'off',
|
2023-02-05 16:15:20 +01:00
|
|
|
|
2023-08-11 17:23:56 +02:00
|
|
|
'react/no-unstable-nested-components': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
allowAsProps: true,
|
|
|
|
|
},
|
|
|
|
|
],
|
2023-03-11 18:05:58 +01:00
|
|
|
|
2023-08-11 17:23:56 +02:00
|
|
|
// seems to be bugged for aliases
|
|
|
|
|
'import/extensions': ['error', 'ignorePackages', { '': 'never' }],
|
2023-06-05 01:42:39 +02:00
|
|
|
|
2023-08-11 17:23:56 +02:00
|
|
|
'no-relative-import-paths/no-relative-import-paths': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
rootDir: 'src',
|
|
|
|
|
prefix: '@',
|
|
|
|
|
},
|
|
|
|
|
],
|
2024-04-14 15:50:12 +02:00
|
|
|
|
|
|
|
|
'no-restricted-imports': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
patterns: [
|
|
|
|
|
{
|
|
|
|
|
group: ['@mui/*', '!@mui/material/', '!@mui/icons-material/', '!@mui/x-date-pickers/'],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
group: ['@mui/*/*/*'],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
'no-restricted-syntax': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
selector: 'TSTypeReference[typeName.name="SxProps"]:not([typeParameters])',
|
|
|
|
|
message: 'SxProps must have Theme parameter to avoid significant compiler slowdown.',
|
|
|
|
|
},
|
|
|
|
|
],
|
2023-02-05 16:15:20 +01:00
|
|
|
},
|
2023-08-11 17:23:56 +02:00
|
|
|
},
|
|
|
|
|
{
|
2023-08-15 22:20:24 +02:00
|
|
|
files: ['tools/scripts/*'],
|
2023-08-11 17:23:56 +02:00
|
|
|
rules: {
|
2023-08-15 22:20:24 +02:00
|
|
|
'no-relative-import-paths/no-relative-import-paths': 'off',
|
|
|
|
|
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
2023-08-11 17:23:56 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
2020-12-24 16:49:43 +03:30
|
|
|
};
|