mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-30 04:15:21 +00:00
a159c3175f
* Add new JS linter rules Adds a few useful rules from eslint-plugin-github. Notable changes: - Forbid dataset usage, its camel-casing behaviour makes it hard to grep for attributes. - Forbid .then() and .catch(), we should generally prefer await for new code. For rare cases where they are useful, a eslint-disable-line directive can be set. - Add docs js to linting * also enable github/array-foreach * small tweak Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
473 lines
14 KiB
YAML
473 lines
14 KiB
YAML
root: true
|
|
reportUnusedDisableDirectives: true
|
|
|
|
ignorePatterns:
|
|
- /web_src/js/vendor
|
|
|
|
parserOptions:
|
|
sourceType: module
|
|
ecmaVersion: 2021
|
|
|
|
plugins:
|
|
- eslint-plugin-unicorn
|
|
- eslint-plugin-import
|
|
- eslint-plugin-vue
|
|
- eslint-plugin-html
|
|
- eslint-plugin-github
|
|
|
|
extends:
|
|
- plugin:vue/recommended
|
|
|
|
env:
|
|
es2021: true
|
|
node: true
|
|
|
|
globals:
|
|
__webpack_public_path__: true
|
|
CodeMirror: false
|
|
Dropzone: false
|
|
SimpleMDE: false
|
|
u2fApi: false
|
|
|
|
settings:
|
|
html/html-extensions: [".tmpl"]
|
|
|
|
overrides:
|
|
- files: ["web_src/**/*.js", "web_src/**/*.vue", "templates/**/*.tmpl"]
|
|
env:
|
|
browser: true
|
|
jquery: true
|
|
node: false
|
|
- files: ["templates/**/*.tmpl"]
|
|
rules:
|
|
no-tabs: [0]
|
|
indent: [2, tab, {SwitchCase: 1}]
|
|
- files: ["web_src/**/*worker.js"]
|
|
env:
|
|
worker: true
|
|
rules:
|
|
no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, status, statusbar, stop, toolbar, top]
|
|
- files: ["build/generate-images.js"]
|
|
rules:
|
|
import/no-unresolved: [0]
|
|
import/no-extraneous-dependencies: [0]
|
|
- files: ["*.test.js"]
|
|
env:
|
|
jest: true
|
|
- files: ["*.config.js"]
|
|
rules:
|
|
import/no-unused-modules: [0]
|
|
|
|
rules:
|
|
accessor-pairs: [2]
|
|
array-bracket-newline: [0]
|
|
array-bracket-spacing: [2, never]
|
|
array-callback-return: [0]
|
|
array-element-newline: [0]
|
|
arrow-body-style: [0]
|
|
arrow-parens: [2, always]
|
|
arrow-spacing: [2, {before: true, after: true}]
|
|
block-scoped-var: [2]
|
|
brace-style: [2, 1tbs, {allowSingleLine: true}]
|
|
camelcase: [0]
|
|
capitalized-comments: [0]
|
|
class-methods-use-this: [0]
|
|
comma-dangle: [2, only-multiline]
|
|
comma-spacing: [2, {before: false, after: true}]
|
|
comma-style: [2, last]
|
|
complexity: [0]
|
|
computed-property-spacing: [2, never]
|
|
consistent-return: [0]
|
|
consistent-this: [0]
|
|
constructor-super: [2]
|
|
curly: [0]
|
|
default-case-last: [2]
|
|
default-case: [0]
|
|
default-param-last: [0]
|
|
dot-location: [2, property]
|
|
dot-notation: [0]
|
|
eol-last: [2]
|
|
eqeqeq: [2]
|
|
for-direction: [2]
|
|
func-call-spacing: [2, never]
|
|
func-name-matching: [2]
|
|
func-names: [0]
|
|
func-style: [0]
|
|
function-call-argument-newline: [0]
|
|
function-paren-newline: [0]
|
|
generator-star-spacing: [0]
|
|
getter-return: [2]
|
|
github/array-foreach: [2]
|
|
github/async-currenttarget: [2]
|
|
github/async-preventdefault: [2]
|
|
github/authenticity-token: [0]
|
|
github/get-attribute: [2]
|
|
github/js-class-name: [0]
|
|
github/no-blur: [0]
|
|
github/no-d-none: [0]
|
|
github/no-dataset: [2]
|
|
github/no-implicit-buggy-globals: [0]
|
|
github/no-inner-html: [0]
|
|
github/no-innerText: [2]
|
|
github/no-then: [2]
|
|
github/no-useless-passive: [2]
|
|
github/prefer-observers: [0]
|
|
github/require-passive-events: [2]
|
|
github/unescaped-html-literal: [0]
|
|
grouped-accessor-pairs: [2]
|
|
guard-for-in: [0]
|
|
id-blacklist: [0]
|
|
id-length: [0]
|
|
id-match: [0]
|
|
implicit-arrow-linebreak: [0]
|
|
import/default: [0]
|
|
import/dynamic-import-chunkname: [0]
|
|
import/export: [2]
|
|
import/exports-last: [0]
|
|
import/extensions: [2, always, {ignorePackages: true}]
|
|
import/first: [2]
|
|
import/group-exports: [0]
|
|
import/max-dependencies: [0]
|
|
import/named: [2]
|
|
import/namespace: [0]
|
|
import/newline-after-import: [0]
|
|
import/no-absolute-path: [0]
|
|
import/no-amd: [0]
|
|
import/no-anonymous-default-export: [0]
|
|
import/no-commonjs: [0]
|
|
import/no-cycle: [2, {ignoreExternal: true, maxDepth: 1}]
|
|
import/no-default-export: [0]
|
|
import/no-deprecated: [0]
|
|
import/no-dynamic-require: [0]
|
|
import/no-extraneous-dependencies: [2]
|
|
import/no-import-module-exports: [0]
|
|
import/no-internal-modules: [0]
|
|
import/no-mutable-exports: [2]
|
|
import/no-named-as-default-member: [0]
|
|
import/no-named-as-default: [2]
|
|
import/no-named-default: [0]
|
|
import/no-named-export: [0]
|
|
import/no-namespace: [0]
|
|
import/no-nodejs-modules: [0]
|
|
import/no-relative-packages: [0]
|
|
import/no-relative-parent-imports: [0]
|
|
import/no-restricted-paths: [0]
|
|
import/no-self-import: [2]
|
|
import/no-unassigned-import: [0]
|
|
import/no-unresolved: [2, {commonjs: true}]
|
|
import/no-unused-modules: [2, {unusedExports: true}]
|
|
import/no-useless-path-segments: [2, {commonjs: true}]
|
|
import/no-webpack-loader-syntax: [2]
|
|
import/order: [0]
|
|
import/prefer-default-export: [0]
|
|
import/unambiguous: [0]
|
|
indent: [2, 2, {SwitchCase: 1}]
|
|
init-declarations: [0]
|
|
key-spacing: [2]
|
|
keyword-spacing: [2]
|
|
line-comment-position: [0]
|
|
linebreak-style: [2, unix]
|
|
lines-around-comment: [0]
|
|
lines-between-class-members: [0]
|
|
max-classes-per-file: [0]
|
|
max-depth: [0]
|
|
max-len: [0]
|
|
max-lines-per-function: [0]
|
|
max-lines: [0]
|
|
max-nested-callbacks: [0]
|
|
max-params: [0]
|
|
max-statements-per-line: [0]
|
|
max-statements: [0]
|
|
multiline-comment-style: [2, separate-lines]
|
|
multiline-ternary: [0]
|
|
new-cap: [0]
|
|
new-parens: [2]
|
|
newline-per-chained-call: [0]
|
|
no-alert: [0]
|
|
no-array-constructor: [2]
|
|
no-async-promise-executor: [2]
|
|
no-await-in-loop: [0]
|
|
no-bitwise: [0]
|
|
no-buffer-constructor: [0]
|
|
no-caller: [2]
|
|
no-case-declarations: [2]
|
|
no-class-assign: [2]
|
|
no-compare-neg-zero: [2]
|
|
no-cond-assign: [2, except-parens]
|
|
no-confusing-arrow: [0]
|
|
no-console: [1, {allow: [info, warn, error]}]
|
|
no-const-assign: [2]
|
|
no-constant-condition: [0]
|
|
no-constructor-return: [2]
|
|
no-continue: [0]
|
|
no-control-regex: [0]
|
|
no-debugger: [1]
|
|
no-delete-var: [2]
|
|
no-div-regex: [0]
|
|
no-dupe-args: [2]
|
|
no-dupe-class-members: [2]
|
|
no-dupe-else-if: [2]
|
|
no-dupe-keys: [2]
|
|
no-duplicate-case: [2]
|
|
no-duplicate-imports: [2]
|
|
no-else-return: [2]
|
|
no-empty-character-class: [2]
|
|
no-empty-function: [0]
|
|
no-empty-pattern: [2]
|
|
no-empty: [2, {allowEmptyCatch: true}]
|
|
no-eq-null: [2]
|
|
no-eval: [2]
|
|
no-ex-assign: [2]
|
|
no-extend-native: [2]
|
|
no-extra-bind: [2]
|
|
no-extra-boolean-cast: [2]
|
|
no-extra-label: [0]
|
|
no-extra-parens: [0]
|
|
no-extra-semi: [2]
|
|
no-fallthrough: [2]
|
|
no-floating-decimal: [0]
|
|
no-func-assign: [2]
|
|
no-global-assign: [2]
|
|
no-implicit-coercion: [0]
|
|
no-implicit-globals: [0]
|
|
no-implied-eval: [2]
|
|
no-import-assign: [2]
|
|
no-inline-comments: [0]
|
|
no-inner-declarations: [2]
|
|
no-invalid-regexp: [2]
|
|
no-invalid-this: [0]
|
|
no-irregular-whitespace: [2]
|
|
no-iterator: [2]
|
|
no-label-var: [2]
|
|
no-labels: [2]
|
|
no-lone-blocks: [2]
|
|
no-lonely-if: [0]
|
|
no-loop-func: [0]
|
|
no-loss-of-precision: [2]
|
|
no-magic-numbers: [0]
|
|
no-misleading-character-class: [2]
|
|
no-mixed-operators: [0]
|
|
no-mixed-spaces-and-tabs: [2]
|
|
no-multi-assign: [0]
|
|
no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true}}]
|
|
no-multi-str: [2]
|
|
no-negated-condition: [0]
|
|
no-nested-ternary: [0]
|
|
no-new-func: [2]
|
|
no-new-object: [2]
|
|
no-new-symbol: [2]
|
|
no-new-wrappers: [2]
|
|
no-new: [0]
|
|
no-nonoctal-decimal-escape: [2]
|
|
no-obj-calls: [2]
|
|
no-octal-escape: [2]
|
|
no-octal: [2]
|
|
no-param-reassign: [0]
|
|
no-plusplus: [0]
|
|
no-promise-executor-return: [0]
|
|
no-proto: [2]
|
|
no-prototype-builtins: [2]
|
|
no-redeclare: [2]
|
|
no-regex-spaces: [2]
|
|
no-restricted-exports: [0]
|
|
no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, self, status, statusbar, stop, toolbar, top]
|
|
no-restricted-imports: [0]
|
|
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement]
|
|
no-return-assign: [0]
|
|
no-return-await: [0]
|
|
no-script-url: [2]
|
|
no-self-assign: [2, {props: true}]
|
|
no-self-compare: [2]
|
|
no-sequences: [2]
|
|
no-setter-return: [2]
|
|
no-shadow-restricted-names: [2]
|
|
no-shadow: [0]
|
|
no-sparse-arrays: [2]
|
|
no-tabs: [2]
|
|
no-template-curly-in-string: [2]
|
|
no-ternary: [0]
|
|
no-this-before-super: [2]
|
|
no-throw-literal: [2]
|
|
no-trailing-spaces: [2]
|
|
no-undef-init: [2]
|
|
no-undef: [2, {typeof: true}]
|
|
no-undefined: [0]
|
|
no-underscore-dangle: [0]
|
|
no-unexpected-multiline: [2]
|
|
no-unmodified-loop-condition: [2]
|
|
no-unneeded-ternary: [0]
|
|
no-unreachable-loop: [2]
|
|
no-unreachable: [2]
|
|
no-unsafe-finally: [2]
|
|
no-unsafe-negation: [2]
|
|
no-unused-expressions: [2]
|
|
no-unused-labels: [2]
|
|
no-unused-vars: [2, {args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_, caughtErrorsIgnorePattern: ^_, ignoreRestSiblings: false}]
|
|
no-use-before-define: [2, nofunc]
|
|
no-useless-backreference: [0]
|
|
no-useless-call: [2]
|
|
no-useless-catch: [2]
|
|
no-useless-computed-key: [2]
|
|
no-useless-concat: [2]
|
|
no-useless-constructor: [2]
|
|
no-useless-escape: [2]
|
|
no-useless-rename: [2]
|
|
no-useless-return: [2]
|
|
no-var: [2]
|
|
no-void: [2]
|
|
no-warning-comments: [0]
|
|
no-whitespace-before-property: [2]
|
|
no-with: [2]
|
|
nonblock-statement-body-position: [2]
|
|
object-curly-newline: [0]
|
|
object-curly-spacing: [2, never]
|
|
object-shorthand: [2, always]
|
|
one-var-declaration-per-line: [0]
|
|
one-var: [0]
|
|
operator-assignment: [2, always]
|
|
operator-linebreak: [2, after]
|
|
padded-blocks: [2, never]
|
|
padding-line-between-statements: [0]
|
|
prefer-arrow-callback: [2, {allowNamedFunctions: true, allowUnboundThis: true}]
|
|
prefer-const: [2, {destructuring: all}]
|
|
prefer-destructuring: [0]
|
|
prefer-exponentiation-operator: [2]
|
|
prefer-named-capture-group: [0]
|
|
prefer-numeric-literals: [2]
|
|
prefer-object-spread: [0]
|
|
prefer-promise-reject-errors: [2, {allowEmptyReject: false}]
|
|
prefer-regex-literals: [2]
|
|
prefer-rest-params: [2]
|
|
prefer-spread: [2]
|
|
prefer-template: [2]
|
|
quote-props: [0]
|
|
quotes: [2, single, {avoidEscape: true, allowTemplateLiterals: true}]
|
|
radix: [2, as-needed]
|
|
require-atomic-updates: [0]
|
|
require-await: [0]
|
|
require-unicode-regexp: [0]
|
|
require-yield: [2]
|
|
rest-spread-spacing: [2, never]
|
|
semi-spacing: [2, {before: false, after: true}]
|
|
semi-style: [2, last]
|
|
semi: [2, always, {omitLastInOneLineBlock: true}]
|
|
sort-imports: [0]
|
|
sort-keys: [0]
|
|
sort-vars: [0]
|
|
space-before-blocks: [2, always]
|
|
space-in-parens: [2, never]
|
|
space-infix-ops: [2]
|
|
space-unary-ops: [2]
|
|
spaced-comment: [2, always]
|
|
strict: [0]
|
|
switch-colon-spacing: [2]
|
|
symbol-description: [2]
|
|
template-curly-spacing: [2, never]
|
|
template-tag-spacing: [2, never]
|
|
unicode-bom: [2, never]
|
|
unicorn/better-regex: [0]
|
|
unicorn/catch-error-name: [0]
|
|
unicorn/consistent-destructuring: [2]
|
|
unicorn/consistent-function-scoping: [2]
|
|
unicorn/custom-error-definition: [0]
|
|
unicorn/empty-brace-spaces: [2]
|
|
unicorn/error-message: [0]
|
|
unicorn/escape-case: [0]
|
|
unicorn/expiring-todo-comments: [0]
|
|
unicorn/explicit-length-check: [0]
|
|
unicorn/filename-case: [0]
|
|
unicorn/import-index: [0]
|
|
unicorn/import-style: [0]
|
|
unicorn/new-for-builtins: [2]
|
|
unicorn/no-abusive-eslint-disable: [0]
|
|
unicorn/no-array-for-each: [0]
|
|
unicorn/no-array-instanceof: [0]
|
|
unicorn/no-array-method-this-argument: [2]
|
|
unicorn/no-array-push-push: [2]
|
|
unicorn/no-console-spaces: [0]
|
|
unicorn/no-document-cookie: [2]
|
|
unicorn/no-empty-file: [2]
|
|
unicorn/no-fn-reference-in-iterator: [0]
|
|
unicorn/no-for-loop: [0]
|
|
unicorn/no-hex-escape: [0]
|
|
unicorn/no-invalid-remove-event-listener: [2]
|
|
unicorn/no-keyword-prefix: [0]
|
|
unicorn/no-lonely-if: [2]
|
|
unicorn/no-nested-ternary: [0]
|
|
unicorn/no-new-array: [0]
|
|
unicorn/no-new-buffer: [0]
|
|
unicorn/no-null: [0]
|
|
unicorn/no-object-as-default-parameter: [2]
|
|
unicorn/no-process-exit: [0]
|
|
unicorn/no-reduce: [2]
|
|
unicorn/no-static-only-class: [2]
|
|
unicorn/no-this-assignment: [2]
|
|
unicorn/no-unreadable-array-destructuring: [0]
|
|
unicorn/no-unsafe-regex: [0]
|
|
unicorn/no-unused-properties: [2]
|
|
unicorn/no-useless-fallback-in-spread: [2]
|
|
unicorn/no-useless-length-check: [2]
|
|
unicorn/no-useless-spread: [2]
|
|
unicorn/no-useless-undefined: [0]
|
|
unicorn/no-zero-fractions: [2]
|
|
unicorn/number-literal-case: [0]
|
|
unicorn/numeric-separators-style: [0]
|
|
unicorn/prefer-add-event-listener: [2]
|
|
unicorn/prefer-array-find: [2]
|
|
unicorn/prefer-array-flat-map: [2]
|
|
unicorn/prefer-array-flat: [2]
|
|
unicorn/prefer-array-index-of: [2]
|
|
unicorn/prefer-array-some: [2]
|
|
unicorn/prefer-at: [0]
|
|
unicorn/prefer-dataset: [2]
|
|
unicorn/prefer-date-now: [2]
|
|
unicorn/prefer-default-parameters: [0]
|
|
unicorn/prefer-event-key: [2]
|
|
unicorn/prefer-export-from: [2]
|
|
unicorn/prefer-includes: [2]
|
|
unicorn/prefer-math-trunc: [2]
|
|
unicorn/prefer-modern-dom-apis: [0]
|
|
unicorn/prefer-module: [2]
|
|
unicorn/prefer-negative-index: [2]
|
|
unicorn/prefer-node-append: [0]
|
|
unicorn/prefer-node-protocol: [0]
|
|
unicorn/prefer-node-remove: [0]
|
|
unicorn/prefer-number-properties: [0]
|
|
unicorn/prefer-object-from-entries: [2]
|
|
unicorn/prefer-object-has-own: [0]
|
|
unicorn/prefer-optional-catch-binding: [2]
|
|
unicorn/prefer-prototype-methods: [0]
|
|
unicorn/prefer-query-selector: [0]
|
|
unicorn/prefer-reflect-apply: [0]
|
|
unicorn/prefer-regexp-test: [2]
|
|
unicorn/prefer-replace-all: [0]
|
|
unicorn/prefer-set-has: [0]
|
|
unicorn/prefer-spread: [0]
|
|
unicorn/prefer-starts-ends-with: [2]
|
|
unicorn/prefer-string-slice: [0]
|
|
unicorn/prefer-switch: [0]
|
|
unicorn/prefer-ternary: [0]
|
|
unicorn/prefer-text-content: [2]
|
|
unicorn/prefer-top-level-await: [0]
|
|
unicorn/prefer-trim-start-end: [2]
|
|
unicorn/prefer-type-error: [0]
|
|
unicorn/prevent-abbreviations: [0]
|
|
unicorn/require-array-join-separator: [2]
|
|
unicorn/require-number-to-fixed-digits-argument: [2]
|
|
unicorn/require-post-message-target-origin: [0]
|
|
unicorn/string-content: [0]
|
|
unicorn/template-indent: [2]
|
|
unicorn/throw-new-error: [2]
|
|
use-isnan: [2]
|
|
valid-typeof: [2, {requireStringLiterals: true}]
|
|
vars-on-top: [0]
|
|
vue/attributes-order: [0]
|
|
vue/component-definition-name-casing: [0]
|
|
vue/html-closing-bracket-spacing: [0]
|
|
vue/max-attributes-per-line: [0]
|
|
vue/one-component-per-file: [0]
|
|
wrap-iife: [2, inside]
|
|
wrap-regex: [0]
|
|
yield-star-spacing: [2, after]
|
|
yoda: [2, never]
|