eslint: add @vchikalkin/eslint-config-awesome

This commit is contained in:
vchikalkin 2023-08-01 14:09:06 +03:00
parent 18927d3074
commit 56257e53ee
12 changed files with 2260 additions and 413 deletions

View File

@ -1,10 +1,11 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-custom`
extends: ["custom/common"],
settings: {
next: {
rootDir: ["apps/*/"],
rootDir: ['apps/*/'],
},
react: {
version: 'detect',
},
},
};

43
.vscode/settings.json vendored
View File

@ -1,12 +1,33 @@
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/node_modules": true
},
"explorerExclude.backup": {}
}
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/node_modules": true
},
"explorerExclude.backup": null,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.fixAll.eslint": true,
"source.removeUnusedImports": true
},
"workbench.editor.labelFormat": "short",
"eslint.workingDirectories": [
{ "directory": "apps/web", "changeProcessCWD": true }
],
"eslint.validate": [
"javascript",
"javascriptreact",
"json",
"typescript",
"typescriptreact",
"yaml"
],
"eslint.lintTask.enable": true
}

4
apps/api/.env Normal file
View File

@ -0,0 +1,4 @@
SECRET=secret
TOKEN_TTL=3600
CACHE_TTL=3600
COOKIE_TOKEN_NAME=token

View File

@ -1,61 +1,12 @@
module.exports = {
parser: '@typescript-eslint/parser',
root: true,
extends: [
'@vchikalkin/eslint-config-awesome/typescript/config',
'@vchikalkin/eslint-config-awesome/typescript/rules',
],
parserOptions: {
project: 'tsconfig.json',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin', 'prettier', 'unicorn'],
extends: [
'prettier',
'airbnb-base',
'airbnb-typescript/base',
'plugin:@typescript-eslint/recommended',
'plugin:unicorn/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'linebreak-style': ['error', 'windows'],
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': ['off'],
'import/extensions': 'off',
'object-curly-newline': [
'warn',
{
ObjectExpression: 'always',
ObjectPattern: { multiline: true },
ImportDeclaration: 'never',
ExportDeclaration: { multiline: true, minProperties: 3 },
},
],
'lines-between-class-members': 'off',
'@typescript-eslint/lines-between-class-members': ['off'],
indent: 'off',
'@typescript-eslint/indent': ['off'],
'newline-before-return': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',
// Airbnb prefers forEach
'unicorn/no-array-for-each': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/no-null': 'off',
'unicorn/prefer-node-protocol': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/prefer-module': 'off',
'unicorn/text-encoding-identifier-case': 'off',
'import/no-unresolved': 'warn',
'import/prefer-default-export': 'off',
'class-methods-use-this': 'off',
},
};

View File

@ -46,15 +46,8 @@
"@types/ldap-authentication": "^2.2.0",
"@types/node": "^16.0.0",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.28.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-unicorn": "^43.0.2",
"@vchikalkin/eslint-config-awesome": "^1.1.1",
"eslint": "^8.46.0",
"jest": "28.1.2",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",

10
apps/web/.eslintrc.js Normal file
View File

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

View File

@ -1,3 +0,0 @@
{
"extends": "next/core-web-vitals"
}

View File

@ -14,13 +14,15 @@
"@types/react": "18.0.25",
"@types/react-dom": "18.0.9",
"axios": "^1.2.1",
"eslint": "8.28.0",
"eslint-config-next": "13.0.5",
"next": "13.0.5",
"normalize.css": "^8.0.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"sass": "^1.56.1",
"typescript": "4.9.3"
},
"devDependencies": {
"@vchikalkin/eslint-config-awesome": "^1.1.1",
"eslint": "^8.46.0"
}
}

View File

@ -1,6 +1,6 @@
import Head from 'next/head';
import Login from 'components/Login';
import getConfig from 'next/config';
import Head from 'next/head';
const { publicRuntimeConfig: config } = getConfig();

View File

@ -10,6 +10,7 @@
"build": "turbo run build",
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
},
"devDependencies": {

View File

@ -2,14 +2,21 @@
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "public/dist/**"],
"dependsOn": ["^build"]
},
"lint": {
"dependsOn": ["^build"],
"cache": false,
"outputs": []
},
"lint:fix": {
"dependsOn": ["^build"],
"outputs": []
},
"dev": {
"cache": false
"cache": false,
"persistent": true
}
}
}

2512
yarn.lock

File diff suppressed because it is too large Load Diff