eslint-config: move to framework

This commit is contained in:
undefined committed 2024-07-03 17:35:16 +08:00
1 parent 909c927986
commit 9e4643c1bf
5 files changed
+6 -6

No files matched your search

+165
View File
@@ -0,0 +1,165 @@
extends:
- airbnb-base
- airbnb-typescript/base
env:
es6: true
globals:
Atomics: readonly
SharedArrayBuffer: readonly
BigInt: readonly
parser: '@typescript-eslint/parser'
plugins:
- '@typescript-eslint'
- simple-import-sort
- eslint-plugin-import
- eslint-plugin-github
- '@stylistic'
rules:
'@typescript-eslint/no-shadow': 1
function-call-argument-newline: 0
'@typescript-eslint/dot-notation': 0
'@typescript-eslint/no-implied-eval': 0
'@typescript-eslint/no-throw-literal': 0
'@typescript-eslint/return-await': 0
comma-dangle:
- 1
- always-multiline
no-implicit-coercion:
- warn
- allow: ["!!", "+"]
no-extra-boolean-cast:
- warn
- enforceForLogicalOperands: true
no-empty-pattern: 0
no-multi-str: 0
'@typescript-eslint/no-invalid-this': 0
'@typescript-eslint/type-annotation-spacing': 1
'@typescript-eslint/indent':
- warn
- 4
'@typescript-eslint/lines-between-class-members':
- error
- always
- exceptAfterSingleLine: true
'@typescript-eslint/naming-convention':
- warn
- selector: default
format: [camelCase]
leadingUnderscore: allowSingleOrDouble
- selector: default
filter:
regex: '^([A-Z]|_+id|__call__)$'
match: true
format: null
- selector: variable
modifiers: [destructured]
format: null
- selector: import
format: null
- selector: variable
format: [camelCase, PascalCase, UPPER_CASE]
modifiers: [const]
leadingUnderscore: allowSingleOrDouble
- selector: property
format: [camelCase, PascalCase, UPPER_CASE, snake_case]
leadingUnderscore: allowSingleOrDouble
- selector: [function, parameter, parameterProperty, objectLiteralMethod]
filter:
regex: __call__
match: false
format: [camelCase, PascalCase]
leadingUnderscore: allowSingleOrDouble
- selector: [objectLiteralProperty]
filter:
regex: '^[\d]+$'
match: true
format: null
- selector: [typeProperty, typeMethod, objectLiteralProperty]
modifiers: [requiresQuotes]
format: null
- selector: [typeMethod]
format: [camelCase, PascalCase]
- selector: [enum, class, interface]
format: [PascalCase]
- selector: [typeAlias, enumMember, typeParameter]
format: [PascalCase, camelCase, UPPER_CASE]
'@typescript-eslint/no-redeclare': 0
'@typescript-eslint/default-param-last': 0
default-param-last: 0
'@typescript-eslint/quotes': ['warn', 'single', { avoidEscape: true }]
class-methods-use-this: 0
global-require: 0
guard-for-in: 0
implicit-arrow-linebreak: 0
import/extensions: 0
import/order: 0
consistent-return: 1
func-names: 0
import/newline-after-import: 0
import/no-cycle: 0
import/no-extraneous-dependencies: 0
import/no-named-as-default: 0
import/prefer-default-export: 0
logical-assignment-operators:
- warn
- always
- enforceForIfStatements: true
max-classes-per-file: 0
max-len:
- warn
- 150
newline-per-chained-call: 0
no-bitwise: 0
no-console: 0
no-continue: 0
no-extend-native: 0
no-empty:
- warn
- allowEmptyCatch: true
no-multi-assign: 0
no-nested-ternary: 0
no-param-reassign: 0
no-plusplus: 0
no-return-await: 0
no-shadow: 0
no-underscore-dangle: 0
no-unmodified-loop-condition: 1
prefer-destructuring: 0
function-paren-newline: 0
simple-import-sort/exports: 0
# Note: must disable the base rule as it can report incorrect errors
no-use-before-define: 0
'@typescript-eslint/no-use-before-define': 1
no-unused-vars: 0
'@typescript-eslint/no-unused-vars':
- error
- caughtErrorsIgnorePattern: "^_"
argsIgnorePattern: "^_"
no-restricted-syntax:
- error
- selector: LabeledStatement
message: Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.
- selector: WithStatement
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.'
github/array-foreach: 1
quote-props: 0
'@stylistic/quote-props': [0, as-needed]
simple-import-sort/imports:
- warn
- groups:
- ["^\\u0000"]
-
- "^(node:)?(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)"
- "^"
- "^\\."
+22
View File
@@ -0,0 +1,22 @@
{
"name": "@hydrooj/eslint-config",
"version": "1.0.11",
"license": "MIT",
"main": "react.yaml",
"dependencies": {
"@stylistic/eslint-plugin": "^2.3.0",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-plugin-github": "^5.0.1",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-simple-import-sort": "^12.1.1"
},
"peerDependencies": {
"eslint": ">= 8"
}
}
+27
View File
@@ -0,0 +1,27 @@
extends:
- ./base.yaml
- airbnb/hooks
plugins:
- react
- jsx-a11y
rules:
react-hooks/exhaustive-deps: 0
react/prefer-stateless-function: 0
react/function-component-definition: 0
react/static-property-placement: 0
react/self-closing-comp: 0
react/prop-types: 0
react/jsx-filename-extension: 0
react/jsx-one-expression-per-line: 0
react/jsx-props-no-spreading: 0
react/no-string-refs: 0
react/require-default-props: 0
react/react-in-jsx-scope: 0
react/destructuring-assignment: 0
react/button-has-type: 0
react/forbid-prop-types: 0
jsx-a11y/no-static-element-interactions: 0
jsx-a11y/anchor-is-valid: 0
jsx-a11y/click-events-have-key-events: 0
jsx-a11y/label-has-associated-control: 0
# 'react/no-unknown-property': ['error', { ignore: ['key'] }],
+2 -2
View File
@@ -16,7 +16,7 @@
"koa-router": "^12.0.1",
"lodash": "^4.17.21",
"moment-timezone": "^0.5.45",
"path-to-regexp": "^6.2.2",
"path-to-regexp": "^7.0.0",
"sanitize-filename": "^1.6.3",
"saslprep": "^1.0.3",
"shorty.js": "^1.0.1",
@@ -27,7 +27,7 @@
"@types/koa": "^2.15.0",
"@types/koa-compress": "^4.0.6",
"@types/koa-router": "^7.4.8",
"@types/lodash": "^4.17.5",
"@types/lodash": "^4.17.6",
"@types/saslprep": "^1.0.3",
"@types/ws": "^8.5.10"
}