| 1 |
import js from "@eslint/js"; |
| 2 |
import typescript from "@typescript-eslint/eslint-plugin"; |
| 3 |
import typescriptParser from "@typescript-eslint/parser"; |
| 4 |
import vueTypeScript from "@vue/eslint-config-typescript"; |
| 5 |
import importPlugin from "eslint-plugin-import"; |
| 6 |
import modulesNewlines from "eslint-plugin-modules-newlines"; |
| 7 |
import simpleImportSort from "eslint-plugin-simple-import-sort"; |
| 8 |
import unusedImports from "eslint-plugin-unused-imports"; |
| 9 |
import vue from "eslint-plugin-vue"; |
| 10 |
import vueParser from "vue-eslint-parser"; |
| 11 |
|
| 12 |
export default [ |
| 13 |
js.configs.recommended, |
| 14 |
...vue.configs["flat/recommended"], |
| 15 |
...vueTypeScript(), |
| 16 |
{ |
| 17 |
files: ["webpack.config.js"], |
| 18 |
languageOptions: { |
| 19 |
globals: { |
| 20 |
require: "readonly", |
| 21 |
module: "readonly", |
| 22 |
__dirname: "readonly", |
| 23 |
process: "readonly" |
| 24 |
} |
| 25 |
}, |
| 26 |
rules: { |
| 27 |
"@typescript-eslint/no-require-imports": "off", |
| 28 |
"no-undef": "off" |
| 29 |
} |
| 30 |
}, |
| 31 |
{ |
| 32 |
files: ["src/**/*.{js,jsx,ts,tsx,vue}"], |
| 33 |
ignores: ["types/**/*", "src/styles/**/*"], |
| 34 |
languageOptions: { |
| 35 |
parser: vueParser, |
| 36 |
parserOptions: { |
| 37 |
parser: typescriptParser, |
| 38 |
ecmaVersion: "latest", |
| 39 |
sourceType: "module", |
| 40 |
}, |
| 41 |
globals: { |
| 42 |
browser: true, |
| 43 |
node: true, |
| 44 |
es6: true, |
| 45 |
}, |
| 46 |
}, |
| 47 |
plugins: { |
| 48 |
"@typescript-eslint": typescript, |
| 49 |
vue, |
| 50 |
import: importPlugin, |
| 51 |
"modules-newlines": modulesNewlines, |
| 52 |
"unused-imports": unusedImports, |
| 53 |
"simple-import-sort": simpleImportSort, |
| 54 |
}, |
| 55 |
rules: { |
| 56 |
"no-console": "off", |
| 57 |
"no-debugger": "off", |
| 58 |
"comma-dangle": ["error", "never"], |
| 59 |
"vue/no-multiple-template-root": "off", |
| 60 |
"vue/require-default-prop": "off", |
| 61 |
"vue/no-deprecated-slot-attribute": "off", |
| 62 |
"vue/no-v-html": "off", |
| 63 |
"vue/require-explicit-emits": "error", |
| 64 |
"vue/prop-name-casing": "off", |
| 65 |
"vue/component-definition-name-casing": ["error", "PascalCase"], |
| 66 |
"vue/max-attributes-per-line": [ |
| 67 |
"error", |
| 68 |
{ |
| 69 |
singleline: { |
| 70 |
max: 7, |
| 71 |
}, |
| 72 |
multiline: { |
| 73 |
max: 1, |
| 74 |
}, |
| 75 |
}, |
| 76 |
], |
| 77 |
"vue/html-self-closing": [ |
| 78 |
"error", |
| 79 |
{ |
| 80 |
html: { normal: "always", void: "always", component: "always" }, |
| 81 |
}, |
| 82 |
], |
| 83 |
"vue/component-name-in-template-casing": [ |
| 84 |
"error", |
| 85 |
"PascalCase", |
| 86 |
{ |
| 87 |
ignores: ["/^hp-/"], |
| 88 |
registeredComponentsOnly: true, |
| 89 |
globals: [], |
| 90 |
}, |
| 91 |
], |
| 92 |
"vue/html-indent": "off", |
| 93 |
"vue/singleline-html-element-content-newline": "off", |
| 94 |
"vue/valid-v-for": "error", |
| 95 |
|
| 96 |
"vue/component-options-name-casing": ["error", "PascalCase"], |
| 97 |
"vue/custom-event-name-casing": ["error", "kebab-case"], |
| 98 |
"vue/define-macros-order": ["error", { |
| 99 |
order: ['defineProps', 'defineEmits'], |
| 100 |
}], |
| 101 |
"vue/html-comment-content-spacing": ["error", "always"], |
| 102 |
"vue/no-unused-refs": "error", |
| 103 |
"vue/padding-line-between-blocks": ["error", "always"], |
| 104 |
"vue/prefer-separate-static-class": "error", |
| 105 |
"arrow-parens": ["error", "always"], |
| 106 |
"no-nested-ternary": "error", |
| 107 |
"vue/attribute-hyphenation": [ |
| 108 |
"off", |
| 109 |
"error", |
| 110 |
"never", |
| 111 |
{ |
| 112 |
ignore: ["custom-prop"], |
| 113 |
}, |
| 114 |
], |
| 115 |
"no-multiple-empty-lines": ["error", { max: 1, maxEOF: 1 }], |
| 116 |
"no-trailing-spaces": ["error"], |
| 117 |
"quote-props": ["error", "as-needed"], |
| 118 |
semi: ["error", "always"], |
| 119 |
"prefer-const": "error", |
| 120 |
"no-const-assign": "error", |
| 121 |
"no-array-constructor": "error", |
| 122 |
"no-new-object": "error", |
| 123 |
"newline-before-return": ["error"], |
| 124 |
"simple-import-sort/imports": [ |
| 125 |
"error", |
| 126 |
{ |
| 127 |
groups: [ |
| 128 |
[ |
| 129 |
"^(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)(/.*|$)", |
| 130 |
], |
| 131 |
["^@?\\w"], |
| 132 |
["^(@|@company|@ui|components|utils|config|vendored-lib)(/.*|$)"], |
| 133 |
["^\\u0000"], |
| 134 |
["^\\.\\.(?!/?$)", "^\\.\\./?$"], |
| 135 |
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"], |
| 136 |
], |
| 137 |
}, |
| 138 |
], |
| 139 |
"simple-import-sort/exports": "error", |
| 140 |
"import/extensions": [ |
| 141 |
"error", |
| 142 |
"ignorePackages", |
| 143 |
{ |
| 144 |
"": "never", |
| 145 |
js: "never", |
| 146 |
ts: "never", |
| 147 |
vue: "ignorePackages", |
| 148 |
}, |
| 149 |
], |
| 150 |
"@typescript-eslint/no-unused-vars": "off", |
| 151 |
"no-unused-vars": "off", |
| 152 |
"unused-imports/no-unused-imports": "error", |
| 153 |
"unused-imports/no-unused-vars": [ |
| 154 |
"error", |
| 155 |
{ |
| 156 |
vars: "all", |
| 157 |
varsIgnorePattern: "^_", |
| 158 |
args: "after-used", |
| 159 |
argsIgnorePattern: "^_", |
| 160 |
}, |
| 161 |
], |
| 162 |
"@typescript-eslint/no-explicit-any": "warn", |
| 163 |
"camelcase": ["error", { |
| 164 |
properties: 'always', |
| 165 |
allow: ['^[A-Z][a-zA-Z0-9]*$', '^[A-Z_][A-Z0-9_]*$', '^hostinger_tools_data$', '^hst_affiliate_data$'], |
| 166 |
ignoreDestructuring: false, |
| 167 |
ignoreImports: true, |
| 168 |
ignoreGlobals: true |
| 169 |
}], |
| 170 |
"func-style": "error", |
| 171 |
"wrap-iife": "error", |
| 172 |
"no-loop-func": "error", |
| 173 |
"prefer-rest-params": "error", |
| 174 |
"no-new-func": "error", |
| 175 |
"no-duplicate-imports": "error", |
| 176 |
"prefer-promise-reject-errors": "error", |
| 177 |
"no-param-reassign": [ |
| 178 |
"error", |
| 179 |
{ |
| 180 |
props: false, |
| 181 |
}, |
| 182 |
], |
| 183 |
"prefer-spread": "error", |
| 184 |
"vue/order-in-components": "off", |
| 185 |
"vue/multi-word-component-names": "off", |
| 186 |
"arrow-spacing": "error", |
| 187 |
"prefer-arrow-callback": "error", |
| 188 |
"arrow-body-style": ["error", "as-needed"], |
| 189 |
"lines-around-comment": [ |
| 190 |
"error", |
| 191 |
{ |
| 192 |
beforeBlockComment: true, |
| 193 |
allowBlockStart: true, |
| 194 |
allowClassStart: true, |
| 195 |
allowObjectStart: true, |
| 196 |
allowArrayStart: true, |
| 197 |
}, |
| 198 |
], |
| 199 |
"padding-line-between-statements": [ |
| 200 |
"error", |
| 201 |
{ blankLine: "always", prev: "import", next: "*" }, |
| 202 |
{ blankLine: "any", prev: "import", next: "import" }, |
| 203 |
{ blankLine: "always", prev: "*", next: ["const", "let", "var"] }, |
| 204 |
{ |
| 205 |
blankLine: "any", |
| 206 |
prev: ["const", "let", "var"], |
| 207 |
next: ["const", "let", "var"], |
| 208 |
}, |
| 209 |
], |
| 210 |
}, |
| 211 |
}, |
| 212 |
{ |
| 213 |
files: ["**/*.vue"], |
| 214 |
rules: { |
| 215 |
"vue/multi-word-component-names": "off" |
| 216 |
} |
| 217 |
} |
| 218 |
]; |
| 219 |
|