mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-10-31 22:38:49 +00:00
94b882fb95
Part of #738 ``` pnpx cspell lint --gitignore '{**,.*}/{*,.*}' ``` --------- Co-authored-by: Anbraten <anton@ju60.de> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de>
161 lines
5.3 KiB
JavaScript
161 lines
5.3 KiB
JavaScript
// cSpell:ignore TSES
|
|
// @ts-check
|
|
/** @type {import('@typescript-eslint/experimental-utils').TSESLint.Linter.Config} */
|
|
|
|
/* eslint-env node */
|
|
module.exports = {
|
|
env: {
|
|
browser: true,
|
|
},
|
|
reportUnusedDisableDirectives: true,
|
|
|
|
parser: 'vue-eslint-parser',
|
|
parserOptions: {
|
|
project: ['./tsconfig.eslint.json'],
|
|
tsconfigRootDir: __dirname,
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore see https://github.com/vuejs/vue-eslint-parser#parseroptionsparser
|
|
parser: '@typescript-eslint/parser',
|
|
sourceType: 'module',
|
|
extraFileExtensions: ['.vue'],
|
|
},
|
|
|
|
plugins: ['@typescript-eslint', 'import', 'simple-import-sort'],
|
|
extends: [
|
|
'eslint:recommended',
|
|
'plugin:@typescript-eslint/recommended',
|
|
'airbnb-base',
|
|
'airbnb-typescript/base',
|
|
'plugin:import/errors',
|
|
'plugin:import/warnings',
|
|
'plugin:import/typescript',
|
|
'plugin:promise/recommended',
|
|
'plugin:vue/vue3-recommended',
|
|
'plugin:prettier/recommended',
|
|
'plugin:vue-scoped-css/recommended',
|
|
],
|
|
|
|
rules: {
|
|
// enable scope analysis rules
|
|
'no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-vars': 'error',
|
|
'no-use-before-define': 'off',
|
|
'@typescript-eslint/no-use-before-define': 'error',
|
|
'no-shadow': 'off',
|
|
'@typescript-eslint/no-shadow': 'error',
|
|
'no-redeclare': 'off',
|
|
'@typescript-eslint/no-redeclare': 'error',
|
|
|
|
// make typescript eslint rules even more strict
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
// SOURCE: https://github.com/iamturns/eslint-config-airbnb-typescript/blob/4aec5702be5b4e74e0e2f40bc78b4bc961681de1/lib/shared.js#L41
|
|
'@typescript-eslint/naming-convention': [
|
|
'error',
|
|
// Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables (23.10)
|
|
{
|
|
selector: 'variable',
|
|
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
leadingUnderscore: 'allow',
|
|
},
|
|
// Allow camelCase functions (23.2), and PascalCase functions (23.8)
|
|
{
|
|
selector: 'function',
|
|
format: ['camelCase', 'PascalCase'],
|
|
},
|
|
// Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make TypeScript recommendations, we are assuming this rule would similarly apply to anything "type like", including interfaces, type aliases, and enums
|
|
{
|
|
selector: 'typeLike',
|
|
format: ['PascalCase'],
|
|
},
|
|
],
|
|
|
|
'import/no-unresolved': 'off', // disable as this is handled by tsc itself
|
|
'import/first': 'error',
|
|
'import/newline-after-import': 'error',
|
|
'import/no-cycle': 'error',
|
|
'import/no-relative-parent-imports': 'error',
|
|
'import/no-duplicates': 'error',
|
|
'import/no-extraneous-dependencies': 'error',
|
|
'import/extensions': 'off',
|
|
'import/prefer-default-export': 'off',
|
|
|
|
'simple-import-sort/imports': 'error',
|
|
'simple-import-sort/exports': 'error',
|
|
|
|
'promise/prefer-await-to-then': 'error',
|
|
'promise/prefer-await-to-callbacks': 'error',
|
|
|
|
'no-underscore-dangle': 'off',
|
|
'no-else-return': ['error', { allowElseIf: false }],
|
|
'no-return-assign': ['error', 'always'],
|
|
'no-return-await': 'error',
|
|
'no-useless-return': 'error',
|
|
'no-restricted-imports': [
|
|
'error',
|
|
{
|
|
patterns: ['src', 'dist'],
|
|
},
|
|
],
|
|
'no-console': 'warn',
|
|
'no-useless-concat': 'error',
|
|
'prefer-const': 'error',
|
|
'spaced-comment': ['error', 'always'],
|
|
'object-shorthand': ['error', 'always'],
|
|
'no-useless-rename': 'error',
|
|
eqeqeq: 'error',
|
|
|
|
'vue/attribute-hyphenation': 'error',
|
|
// enable in accordance with https://github.com/prettier/eslint-config-prettier#vuehtml-self-closing
|
|
'vue/html-self-closing': [
|
|
'error',
|
|
{
|
|
html: {
|
|
void: 'any',
|
|
},
|
|
},
|
|
],
|
|
'vue/no-static-inline-styles': 'error',
|
|
'vue/v-on-function-call': 'error',
|
|
'vue/no-useless-v-bind': 'error',
|
|
'vue/no-useless-mustaches': 'error',
|
|
'vue/no-useless-concat': 'error',
|
|
'vue/no-boolean-default': 'error',
|
|
'vue/html-button-has-type': 'error',
|
|
'vue/component-name-in-template-casing': 'error',
|
|
'vue/match-component-file-name': [
|
|
'error',
|
|
{
|
|
extensions: ['vue'],
|
|
shouldMatchCase: true,
|
|
},
|
|
],
|
|
'vue/require-name-property': 'error',
|
|
'vue/v-for-delimiter-style': 'error',
|
|
'vue/no-empty-component-block': 'error',
|
|
'vue/no-duplicate-attr-inheritance': 'error',
|
|
'vue/no-unused-properties': [
|
|
'error',
|
|
{
|
|
groups: ['props', 'data', 'computed', 'methods', 'setup'],
|
|
},
|
|
],
|
|
'vue/new-line-between-multi-line-property': 'error',
|
|
'vue/padding-line-between-blocks': 'error',
|
|
'vue/multi-word-component-names': 'off',
|
|
'vue/no-reserved-component-names': 'off',
|
|
|
|
// css rules
|
|
'vue-scoped-css/no-unused-selector': 'error',
|
|
'vue-scoped-css/no-parsing-error': 'error',
|
|
'vue-scoped-css/require-scoped': 'error',
|
|
|
|
// enable in accordance with https://github.com/prettier/eslint-config-prettier#curly
|
|
curly: ['error', 'all'],
|
|
|
|
// risky because of https://github.com/prettier/eslint-plugin-prettier#arrow-body-style-and-prefer-arrow-callback-issue
|
|
'arrow-body-style': 'error',
|
|
'prefer-arrow-callback': 'error',
|
|
},
|
|
};
|