configs: rewrite from zero
This commit is contained in:
parent
56a4255144
commit
208cb9f414
14
graphql.js
14
graphql.js
@ -1,14 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es2022: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
|
|
||||||
{
|
|
||||||
extends: ['canonical/graphql'],
|
|
||||||
files: ['*.graphql'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
194
index.js
194
index.js
@ -1,194 +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',
|
|
||||||
],
|
|
||||||
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',
|
|
||||||
],
|
|
||||||
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',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
13
json.js
13
json.js
@ -1,13 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es2022: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
extends: ['canonical/json'],
|
|
||||||
files: '*.json',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
47
next-typescript/config.js
Normal file
47
next-typescript/config.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
const { defineConfig } = require('eslint-define-config');
|
||||||
|
|
||||||
|
module.exports = defineConfig({
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es2022: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
},
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
extends: [
|
||||||
|
'canonical',
|
||||||
|
'plugin:sonarjs/recommended',
|
||||||
|
'canonical/next',
|
||||||
|
'prettier',
|
||||||
|
],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
extends: ['canonical/typescript'],
|
||||||
|
files: '*.ts',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['canonical/react', 'canonical/typescript'],
|
||||||
|
files: '*.tsx',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['canonical/react'],
|
||||||
|
files: '*.jsx',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['canonical/graphql'],
|
||||||
|
files: ['*.graphql'],
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
|
||||||
|
// extends: ['plugin:testing-library/react', 'canonical/jest'],
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'sonarjs',
|
||||||
|
'@typescript-eslint',
|
||||||
|
'prettier',
|
||||||
|
// 'testing-library',
|
||||||
|
],
|
||||||
|
});
|
||||||
15
next-typescript/rules.js
Normal file
15
next-typescript/rules.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
const javascript = require('../rules/javascript');
|
||||||
|
const typescript = require('../rules/typescript');
|
||||||
|
const sonar = require('../rules/sonar');
|
||||||
|
const react = require('../rules/react');
|
||||||
|
const next = require('../rules/next');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
...javascript.rules,
|
||||||
|
...typescript.rules,
|
||||||
|
...sonar.rules,
|
||||||
|
...react.rules,
|
||||||
|
...next.rules,
|
||||||
|
},
|
||||||
|
};
|
||||||
11
next.js
11
next.js
@ -1,11 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es2022: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 2022,
|
|
||||||
},
|
|
||||||
extends: ['next'],
|
|
||||||
};
|
|
||||||
37
next/config.js
Normal file
37
next/config.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
const { defineConfig } = require('eslint-define-config');
|
||||||
|
|
||||||
|
module.exports = defineConfig({
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es2022: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
},
|
||||||
|
extends: [
|
||||||
|
'canonical',
|
||||||
|
'plugin:sonarjs/recommended',
|
||||||
|
'canonical/next',
|
||||||
|
'prettier',
|
||||||
|
],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
extends: ['canonical/react'],
|
||||||
|
files: '*.jsx',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['canonical/graphql'],
|
||||||
|
files: ['*.graphql'],
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
|
||||||
|
// extends: ['plugin:testing-library/react', 'canonical/jest'],
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'sonarjs',
|
||||||
|
'prettier',
|
||||||
|
// 'testing-library',
|
||||||
|
],
|
||||||
|
});
|
||||||
13
next/rules.js
Normal file
13
next/rules.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const javascript = require('../rules/javascript');
|
||||||
|
const sonar = require('../rules/sonar');
|
||||||
|
const react = require('../rules/react');
|
||||||
|
const next = require('../rules/next');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
...javascript.rules,
|
||||||
|
...sonar.rules,
|
||||||
|
...react.rules,
|
||||||
|
...next.rules,
|
||||||
|
},
|
||||||
|
};
|
||||||
30
package.json
30
package.json
@ -1,34 +1,34 @@
|
|||||||
{
|
{
|
||||||
"name": "@vchikalkin/eslint-config-awesome",
|
"name": "@vchikalkin/eslint-config-awesome",
|
||||||
"version": "1.0.5",
|
"version": "1.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/parser": "^5.60.0",
|
"@typescript-eslint/parser": "^6.2.1",
|
||||||
"eslint-config-canonical": "^41.1.3",
|
"eslint": "^8.46.0",
|
||||||
"eslint-config-next": "^13.4.7",
|
"eslint-config-canonical": "^41.1.7",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.9.0",
|
||||||
"eslint-plugin-canonical": "^4.4.4",
|
"eslint-define-config": "^1.22.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-canonical": "^4.9.0",
|
||||||
|
"eslint-plugin-prettier": "^5.0.0",
|
||||||
"eslint-plugin-sonarjs": "^0.19.0",
|
"eslint-plugin-sonarjs": "^0.19.0",
|
||||||
"eslint-plugin-testing-library": "^5.11.0"
|
"typescript": "^5.1.6"
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"eslint": "^8.43.0"
|
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"description": "Custom ESLint config for Next.js apps",
|
"description": "Custom ESLint config for Next.js/React/Typescript/Javascript apps",
|
||||||
"repository": "https://github.com/vchikalkin/eslint-config-awesome",
|
"repository": "https://github.com/vchikalkin/eslint-config-awesome",
|
||||||
"author": "vchikalkin",
|
"author": "vchikalkin",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"config",
|
"config",
|
||||||
"eslint",
|
"eslint",
|
||||||
"json",
|
|
||||||
"nextjs",
|
|
||||||
"prettier",
|
|
||||||
"react",
|
"react",
|
||||||
|
"nextjs",
|
||||||
|
"typescript",
|
||||||
|
"javascript",
|
||||||
|
"prettier",
|
||||||
|
"json",
|
||||||
"zod"
|
"zod"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
29
react-typescript/config.js
vendored
Normal file
29
react-typescript/config.js
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
const { defineConfig } = require('eslint-define-config');
|
||||||
|
|
||||||
|
module.exports = defineConfig({
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es2022: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
},
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
extends: ['canonical', 'plugin:sonarjs/recommended', 'prettier'],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
extends: ['canonical/typescript'],
|
||||||
|
files: '*.ts',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['canonical/react', 'canonical/typescript'],
|
||||||
|
files: '*.tsx',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['canonical/react'],
|
||||||
|
files: '*.jsx',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
plugins: ['sonarjs', '@typescript-eslint', 'prettier'],
|
||||||
|
});
|
||||||
13
react-typescript/rules.js
vendored
Normal file
13
react-typescript/rules.js
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const javascript = require('../rules/javascript');
|
||||||
|
const typescript = require('../rules/typescript');
|
||||||
|
const sonar = require('../rules/sonar');
|
||||||
|
const react = require('../rules/react');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
...javascript.rules,
|
||||||
|
...typescript.rules,
|
||||||
|
...sonar.rules,
|
||||||
|
...react.rules,
|
||||||
|
},
|
||||||
|
};
|
||||||
32
react.js
vendored
32
react.js
vendored
@ -1,32 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es2022: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 2022,
|
|
||||||
},
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
extends: ['canonical/react', 'canonical/typescript'],
|
|
||||||
files: '*.tsx',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
extends: ['canonical/react'],
|
|
||||||
files: '*.jsx',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
'react/prop-types': 'off',
|
|
||||||
'react/jsx-sort-props': 'off',
|
|
||||||
'react/function-component-definition': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
namedComponents: 'function-declaration',
|
|
||||||
unnamedComponents: 'arrow-function',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@ -1,81 +1,31 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es2022: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 2022,
|
|
||||||
},
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
extends: [
|
|
||||||
'canonical',
|
|
||||||
'plugin:sonarjs/recommended',
|
|
||||||
'eslint:recommended',
|
|
||||||
'prettier',
|
|
||||||
],
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
extends: ['canonical/typescript'],
|
|
||||||
files: '*.ts',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
plugins: ['canonical', 'sonarjs', '@typescript-eslint', 'prettier'],
|
|
||||||
rules: {
|
rules: {
|
||||||
// Disabled
|
// Disabled
|
||||||
'brace-style': 'off',
|
'brace-style': 'off',
|
||||||
'@typescript-eslint/brace-style': 'off',
|
|
||||||
'comma-dangle': 'off',
|
'comma-dangle': 'off',
|
||||||
'@typescript-eslint/comma-dangle': 'off',
|
|
||||||
'comma-spacing': 'off',
|
'comma-spacing': 'off',
|
||||||
'@typescript-eslint/comma-spacing': 'off',
|
|
||||||
'func-call-spacing': 'off',
|
'func-call-spacing': 'off',
|
||||||
'@typescript-eslint/func-call-spacing': 'off',
|
|
||||||
indent: 'off',
|
indent: 'off',
|
||||||
'@typescript-eslint/indent': 'off',
|
|
||||||
'keyword-spacing': 'off',
|
'keyword-spacing': 'off',
|
||||||
'@typescript-eslint/keyword-spacing': 'off',
|
|
||||||
'lines-between-class-members': 'off',
|
'lines-between-class-members': 'off',
|
||||||
'@typescript-eslint/lines-between-class-members': 'off',
|
|
||||||
'@typescript-eslint/member-delimiter-style': 'off',
|
|
||||||
'no-extra-parens': 'off',
|
'no-extra-parens': 'off',
|
||||||
'@typescript-eslint/no-extra-parens': 'off',
|
|
||||||
'object-curly-spacing': 'off',
|
'object-curly-spacing': 'off',
|
||||||
'@typescript-eslint/object-curly-spacing': 'off',
|
|
||||||
'padding-line-between-statements': 'off',
|
'padding-line-between-statements': 'off',
|
||||||
'@typescript-eslint/padding-line-between-statements': 'off',
|
|
||||||
quotes: 'off',
|
quotes: 'off',
|
||||||
'@typescript-eslint/quotes': 'off',
|
|
||||||
semi: 'off',
|
semi: 'off',
|
||||||
'@typescript-eslint/semi': 'off',
|
|
||||||
'space-before-blocks': 'off',
|
'space-before-blocks': 'off',
|
||||||
'@typescript-eslint/space-before-blocks': 'off',
|
|
||||||
'space-before-function-paren': 'off',
|
'space-before-function-paren': 'off',
|
||||||
'@typescript-eslint/space-before-function-paren': 'off',
|
|
||||||
'space-infix-ops': 'off',
|
'space-infix-ops': 'off',
|
||||||
'@typescript-eslint/space-infix-ops': 'off',
|
|
||||||
'@typescript-eslint/type-annotation-spacing': 'off',
|
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
'linebreak-style': ['error', 'windows'],
|
'linebreak-style': ['error', 'windows'],
|
||||||
'import/extensions': 'off',
|
'import/extensions': 'off',
|
||||||
'newline-before-return': 'warn',
|
'newline-before-return': 'warn',
|
||||||
'@typescript-eslint/consistent-type-imports': 'error',
|
|
||||||
'function-paren-newline': 'off',
|
'function-paren-newline': 'off',
|
||||||
'promise/prefer-await-to-then': 'off',
|
'promise/prefer-await-to-then': 'off',
|
||||||
'@typescript-eslint/explicit-member-accessibility': [
|
|
||||||
'warn',
|
|
||||||
{
|
|
||||||
accessibility: 'explicit',
|
|
||||||
overrides: {
|
|
||||||
constructors: 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'id-length': 'warn',
|
'id-length': 'warn',
|
||||||
'import/no-unassigned-import': 'off',
|
'import/no-unassigned-import': 'off',
|
||||||
'import/no-named-as-default-member': 'warn',
|
'import/no-named-as-default-member': 'warn',
|
||||||
'@typescript-eslint/naming-convention': 'warn',
|
|
||||||
|
|
||||||
// Unicorn
|
// Unicorn
|
||||||
'unicorn/no-array-for-each': 'off',
|
'unicorn/no-array-for-each': 'off',
|
||||||
@ -144,8 +94,5 @@ module.exports = {
|
|||||||
requireReturnForObjectLiteral: false,
|
requireReturnForObjectLiteral: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
// Sonar
|
|
||||||
'sonarjs/no-duplicate-string': 'warn',
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
15
rules/next.js
Normal file
15
rules/next.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
// Disabled
|
||||||
|
|
||||||
|
// Unicorn
|
||||||
|
|
||||||
|
// Canonical
|
||||||
|
|
||||||
|
// Ignore
|
||||||
|
'@next/next/link-passhref': 'off',
|
||||||
|
'@next/next/no-script-in-document': 'off',
|
||||||
|
'@next/next/no-script-in-head': 'off',
|
||||||
|
'@next/next/no-server-import-in-page': 'off',
|
||||||
|
},
|
||||||
|
};
|
||||||
13
rules/react.js
vendored
Normal file
13
rules/react.js
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
'react/prop-types': 'off',
|
||||||
|
'react/jsx-sort-props': 'off',
|
||||||
|
'react/function-component-definition': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
namedComponents: 'function-declaration',
|
||||||
|
unnamedComponents: 'arrow-function',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
6
rules/sonar.js
Normal file
6
rules/sonar.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
// Sonar
|
||||||
|
'sonarjs/no-duplicate-string': 'warn',
|
||||||
|
},
|
||||||
|
};
|
||||||
39
rules/typescript.js
Normal file
39
rules/typescript.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
// Disabled
|
||||||
|
'@typescript-eslint/brace-style': 'off',
|
||||||
|
'@typescript-eslint/comma-dangle': 'off',
|
||||||
|
'@typescript-eslint/comma-spacing': 'off',
|
||||||
|
'@typescript-eslint/func-call-spacing': 'off',
|
||||||
|
'@typescript-eslint/indent': 'off',
|
||||||
|
'@typescript-eslint/keyword-spacing': 'off',
|
||||||
|
'@typescript-eslint/lines-between-class-members': 'off',
|
||||||
|
'@typescript-eslint/member-delimiter-style': 'off',
|
||||||
|
'@typescript-eslint/no-extra-parens': 'off',
|
||||||
|
'@typescript-eslint/object-curly-spacing': 'off',
|
||||||
|
'@typescript-eslint/padding-line-between-statements': 'off',
|
||||||
|
'@typescript-eslint/quotes': 'off',
|
||||||
|
'@typescript-eslint/semi': 'off',
|
||||||
|
'@typescript-eslint/space-before-blocks': 'off',
|
||||||
|
'@typescript-eslint/space-before-function-paren': 'off',
|
||||||
|
'@typescript-eslint/space-infix-ops': 'off',
|
||||||
|
'@typescript-eslint/type-annotation-spacing': 'off',
|
||||||
|
|
||||||
|
// Config
|
||||||
|
'@typescript-eslint/consistent-type-imports': 'error',
|
||||||
|
'@typescript-eslint/explicit-member-accessibility': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
accessibility: 'explicit',
|
||||||
|
overrides: {
|
||||||
|
constructors: 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@typescript-eslint/naming-convention': 'warn',
|
||||||
|
|
||||||
|
// Unicorn
|
||||||
|
|
||||||
|
// Canonical
|
||||||
|
},
|
||||||
|
};
|
||||||
18
testing.js
18
testing.js
@ -1,18 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es2022: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 2022,
|
|
||||||
},
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
||||||
extends: ['plugin:testing-library/react', 'canonical/jest'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
plugins: ['testing-library'],
|
|
||||||
};
|
|
||||||
21
typescript/config.js
Normal file
21
typescript/config.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
const { defineConfig } = require('eslint-define-config');
|
||||||
|
|
||||||
|
module.exports = defineConfig({
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es2022: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
},
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
extends: ['canonical', 'plugin:sonarjs/recommended', 'prettier'],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
extends: ['canonical/typescript'],
|
||||||
|
files: '*.ts',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
plugins: ['sonarjs', '@typescript-eslint', 'prettier'],
|
||||||
|
});
|
||||||
11
typescript/rules.js
Normal file
11
typescript/rules.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const javascript = require('../rules/javascript');
|
||||||
|
const typescript = require('../rules/typescript');
|
||||||
|
const sonar = require('../rules/sonar');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
...javascript.rules,
|
||||||
|
...typescript.rules,
|
||||||
|
...sonar.rules,
|
||||||
|
},
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user