blurts-server/.eslintrc.json

143 строки
4.3 KiB
JSON

{
"env": {
"browser": true,
"es2022": true,
"node": true,
"jest": true
},
"extends": [
"plugin:jsdoc/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"next/core-web-vitals",
"next",
"plugin:import/recommended",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["header", "jsdoc", "@typescript-eslint", "check-file", "jest"],
"rules": {
"header/header": [
"warn",
"block",
" This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/. ",
2
],
"jsdoc/tag-lines": ["error", "any", { "startLines": 1 }],
"jsdoc/require-jsdoc": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-property-description": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-returns-type": "off",
"jsdoc/require-returns-description": "off",
// Unused vars explicitly marked as such with an understore prefix are allowed:
"no-unused-vars": [
"off",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
// Unused vars that start with an understore are allowed to be unused:
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": "allow-with-description"
}
],
"check-file/filename-naming-convention": [
"error",
{
"**/*.{js,css} !src/db/migrations": "CAMEL_CASE"
},
{
"ignoreMiddleExtensions": true
}
]
},
"overrides": [
{
"files": ["next-env.d.ts"],
"rules": {
"header/header": "off"
}
},
{
"files": ["**/*.test.{ts,tsx,js}"],
"plugins": ["jest"],
"extends": ["plugin:jest/recommended"]
},
{
"files": [
"src/app.js",
"src/utils/redisMock.js",
"src/routes/**/*.js",
"src/views/**/*.js",
"src/middleware/**/*.js",
"src/controllers/**/*.js",
"src/app/(nextjs_migration)/**/*",
"src/app/functions/server/breachResolution.ts"
],
"rules": {
"jsdoc/no-undefined-types": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"import/no-named-as-default-member": "off",
"import/no-unresolved": "off"
}
},
{
// Only enable rules that depend on type checking on TS files,
// except for files that include a lot of copy-pasted pre-TypeScript code
// (i.e. the code inside `(nextjs_migration)`),
// to avoid a barrage of warnings for older code:
"files": ["**/*.{ts,tsx}"],
"excludedFiles": [
"./src/app/(nextjs_migration)/**/*"
],
"extends": [
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parserOptions": {
// See https://typescript-eslint.io/linting/typed-linting/#specifying-tsconfigs
// Needed for `plugin:@typescript-eslint/recommended-requiring-type-checking`
// to avoid this error:
// > You have used a rule which requires parserServices to be generated.
// > You must therefore provide a value for the "parserOptions.project"
// > property for @typescript-eslint/parser.
"project": "tsconfig.json"
},
"rules": {
// These rules trigger lots of times; possibly we can enable them later:
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off"
}
}
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": true,
"node": true
}
}
}