eslint: use @vchikalkin/eslint-config-awesome

This commit is contained in:
vchikalkin 2023-08-01 13:40:03 +03:00
parent 565cabb9bd
commit 998ae81acf
16 changed files with 810 additions and 722 deletions

View File

@ -8,6 +8,5 @@ coverage
.eslintrc.js
**/*.config.js
**/scripts
packages/eslint-config-custom/*
**/package.json
turbo.json

View File

@ -1,7 +1,5 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-custom`
extends: ['custom', 'custom/rules'],
settings: {
next: {
rootDir: ['packages/web/'],

View File

@ -1,8 +1,11 @@
module.exports = {
root: true,
extends: ['custom', 'custom/rules'],
extends: [
'@vchikalkin/eslint-config-awesome/next-typescript/config',
'@vchikalkin/eslint-config-awesome/next-typescript/rules',
],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
root: true,
};

View File

@ -51,8 +51,8 @@
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@types/styled-components": "^5.1.26",
"eslint": "^8.43.0",
"eslint-config-custom": "*",
"@vchikalkin/eslint-config-awesome": "^1.1.1",
"eslint": "^8.46.0",
"gql-sdl": "^1.0.0",
"jest": "^29.4.3",
"jest-environment-jsdom": "^29.3.1",

View File

@ -17,7 +17,6 @@ import { useMemo } from 'react';
import { ThemeProvider } from 'styled-components';
import { Config as AntdConfig } from 'ui/elements';
// eslint-disable-next-line turbo/no-undeclared-env-vars
if (process.env.NODE_ENV === 'development') {
require('../mocks');
}

View File

@ -1,6 +1,5 @@
/* eslint-disable complexity */
/* eslint-disable sonarjs/cognitive-complexity */
/* eslint-disable zod/require-strict */
import type { ValidationContext } from '../types';
import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types';
import { FinGAPSchema } from '@/config/schema/fingap';

View File

@ -1,4 +1,3 @@
/* eslint-disable zod/require-strict */
import { CalculateInputSchema } from '../calculate/types';
import { RowSchema as EltRowSchema } from '@/config/schema/elt';
import { RiskSchema } from '@/config/schema/fingap';

View File

@ -22,7 +22,6 @@
"dependencies": {},
"devDependencies": {
"dotenv-cli": "^7.0.0",
"eslint-config-custom": "*",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"prettier": "^2.8.4",

View File

@ -1,46 +0,0 @@
module.exports = {
env: {
browser: true,
es2022: true,
node: true,
},
parserOptions: {
ecmaVersion: 2022,
},
parser: '@typescript-eslint/parser',
extends: [
'canonical',
'plugin:sonarjs/recommended',
'eslint:recommended',
'next',
'prettier',
'turbo',
],
overrides: [
{
extends: ['canonical/typescript', 'canonical/zod'],
files: '*.ts',
},
{
extends: ['canonical/react', 'canonical/jsx-a11y', 'canonical/typescript'],
files: '*.tsx',
},
{
extends: ['canonical/react', 'canonical/jsx-a11y'],
files: '*.jsx',
},
{
extends: ['canonical/json'],
files: '*.json',
},
{
extends: ['canonical/graphql'],
files: ['*.graphql'],
},
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
extends: ['plugin:testing-library/react', 'canonical/jest'],
},
],
plugins: ['canonical', 'sonarjs', '@typescript-eslint', 'prettier', 'testing-library'],
};

View File

@ -1,21 +0,0 @@
{
"name": "eslint-config-custom",
"version": "0.0.0",
"license": "MIT",
"main": "index.js",
"devDependencies": {
"@typescript-eslint/parser": "^5.60.0",
"eslint": "^8.43.0",
"eslint-config-canonical": "^41.1.3",
"eslint-config-next": "^13.4.7",
"eslint-config-prettier": "^8.8.0",
"eslint-config-turbo": "^1.10.6",
"eslint-plugin-canonical": "^4.4.4",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-sonarjs": "^0.19.0",
"eslint-plugin-testing-library": "^5.11.0"
},
"publishConfig": {
"access": "public"
}
}

View File

@ -1,144 +0,0 @@
module.exports = {
rules: {
// Disabled
'brace-style': 'off',
'@typescript-eslint/brace-style': 'off',
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': 'off',
'comma-spacing': 'off',
'@typescript-eslint/comma-spacing': 'off',
'func-call-spacing': 'off',
'@typescript-eslint/func-call-spacing': 'off',
indent: 'off',
'@typescript-eslint/indent': 'off',
'keyword-spacing': 'off',
'@typescript-eslint/keyword-spacing': 'off',
'lines-between-class-members': 'off',
'@typescript-eslint/lines-between-class-members': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'no-extra-parens': 'off',
'@typescript-eslint/no-extra-parens': 'off',
'object-curly-spacing': 'off',
'@typescript-eslint/object-curly-spacing': 'off',
'padding-line-between-statements': 'off',
'@typescript-eslint/padding-line-between-statements': 'off',
quotes: 'off',
'@typescript-eslint/quotes': 'off',
semi: 'off',
'@typescript-eslint/semi': 'off',
'space-before-blocks': 'off',
'@typescript-eslint/space-before-blocks': 'off',
'space-before-function-paren': 'off',
'@typescript-eslint/space-before-function-paren': 'off',
'space-infix-ops': 'off',
'@typescript-eslint/space-infix-ops': 'off',
'@typescript-eslint/type-annotation-spacing': 'off',
// Config
'linebreak-style': ['error', 'windows'],
'import/extensions': 'off',
'react/prop-types': 'off',
'newline-before-return': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',
'function-paren-newline': 'off',
'promise/prefer-await-to-then': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'warn',
{
accessibility: 'explicit',
overrides: {
constructors: 'off',
},
},
],
'id-length': 'warn',
'import/no-unassigned-import': 'off',
'import/no-named-as-default-member': 'warn',
'react/jsx-sort-props': 'off',
'@typescript-eslint/naming-convention': 'warn',
// Unicorn
'unicorn/no-array-for-each': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/prefer-node-protocol': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/prefer-module': 'off',
'unicorn/text-encoding-identifier-case': 'off',
'unicorn/filename-case': [
'error',
{
case: 'kebabCase',
ignore: ['^.*.(jsx|tsx)$'],
},
],
'unicorn/numeric-separators-style': [
'warn',
{
onlyIfContainsSeparator: false,
hexadecimal: {
minimumDigits: 0,
groupLength: 2,
},
binary: {
minimumDigits: 0,
groupLength: 4,
},
octal: {
minimumDigits: 0,
groupLength: 4,
},
number: {
minimumDigits: 5,
groupLength: 3,
},
},
],
// Canonical
'canonical/prefer-inline-type-import': 'off',
'@babel/object-curly-spacing': ['off'],
'canonical/filename-match-exported': ['off'],
'canonical/import-specifier-newline': ['off'],
'canonical/destructuring-property-newline': ['off'],
'canonical/export-specifier-newline': 'off',
'canonical/sort-keys': [
'warn',
'asc',
{
natural: true,
},
],
'canonical/id-match': ['off'],
'import/order': [
'error',
{
groups: [],
'newlines-between': 'always',
},
],
'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
'react/function-component-definition': [
'error',
{
namedComponents: 'function-declaration',
unnamedComponents: 'arrow-function',
},
],
'arrow-body-style': [
'error',
'as-needed',
{
requireReturnForObjectLiteral: false,
},
],
// Sonar
'sonarjs/no-duplicate-string': 'warn',
// Zod
'zod/require-strict': 'off',
// Turbo
'turbo/no-undeclared-env-vars': 'warn',
},
};

View File

@ -1,6 +1,9 @@
module.exports = {
root: true,
extends: ['custom', 'custom/rules'],
extends: [
'@vchikalkin/eslint-config-awesome/typescript/config',
'@vchikalkin/eslint-config-awesome/typescript/rules',
],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,

View File

@ -8,8 +8,8 @@
"lint": "TIMING=1 eslint \"**/*.ts*\""
},
"devDependencies": {
"eslint": "^8.43.0",
"eslint-config-custom": "*"
"@vchikalkin/eslint-config-awesome": "^1.1.1",
"eslint": "^8.46.0"
},
"dependencies": {}
}

View File

@ -1,6 +1,9 @@
module.exports = {
root: true,
extends: ['custom', 'custom/rules'],
extends: [
'@vchikalkin/eslint-config-awesome/react-typescript/config',
'@vchikalkin/eslint-config-awesome/react-typescript/rules',
],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,

View File

@ -12,8 +12,8 @@
"@types/react-dom": "^18.2.6",
"@types/rebass": "^4.0.10",
"@types/styled-components": "^5.1.26",
"eslint": "^8.43.0",
"eslint-config-custom": "*",
"@vchikalkin/eslint-config-awesome": "^1.1.1",
"eslint": "^8.46.0",
"react": "^18.2.0",
"tsconfig": "*",
"typescript": "^4.9.5"

1285
yarn.lock

File diff suppressed because it is too large Load Diff