Skip to content

Commit 327aadd

Browse files
Add linters
1 parent c8dbf51 commit 327aadd

File tree

4 files changed

+78
-14
lines changed

4 files changed

+78
-14
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
root = true
1+
root=true
22

33
[*]
44
end_of_line = lf

.eslintrc.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
const defaultRules = {
2+
// No console statements in production
3+
'no-console': process.env.NODE_ENV !== 'development' ? 'error' : 'off',
4+
// No debugger statements in production
5+
'no-debugger': process.env.NODE_ENV !== 'development' ? 'error' : 'off',
6+
// Enforce prettier formatting
7+
'prettier/prettier': 'error',
8+
};
9+
10+
module.exports = {
11+
// Stop looking for ESLint configurations in parent folders
12+
root: true,
13+
// Global variables: Browser and Node.js
14+
env: {
15+
browser: true,
16+
node: true,
17+
},
18+
// Basic configuration for js files
19+
plugins: ['@typescript-eslint', 'prettier'],
20+
extends: ['eslint:recommended', 'prettier'],
21+
rules: defaultRules,
22+
parserOptions: {
23+
ecmaVersion: 2020,
24+
},
25+
overrides: [
26+
// Parse rollup configration as module
27+
{
28+
files: ['rollup.config.js', 'vite.config.js'],
29+
parserOptions: {
30+
sourceType: 'module',
31+
},
32+
},
33+
// Configuration for ts/vue files
34+
{
35+
files: ['*.ts', '*.vue'],
36+
parser: 'vue-eslint-parser',
37+
parserOptions: {
38+
parser: '@typescript-eslint/parser',
39+
},
40+
extends: [
41+
'plugin:vue/vue3-recommended',
42+
'eslint:recommended',
43+
'plugin:@typescript-eslint/recommended',
44+
'prettier',
45+
],
46+
rules: {
47+
...defaultRules,
48+
// It's recommended to turn off this rule on TypeScript projects
49+
'no-undef': 'off',
50+
// Allow ts-directive comments (used to suppress TypeScript compiler errors)
51+
'@typescript-eslint/ban-ts-comment': 'off',
52+
// Allow usage of the any type (consider to enable this rule later on)
53+
'@typescript-eslint/no-explicit-any': 'off',
54+
// Allow usage of require statements (consider to enable this rule later on)
55+
'@typescript-eslint/no-var-requires': 'off',
56+
// Allow non-null assertions for now (consider to enable this rule later on)
57+
'@typescript-eslint/no-non-null-assertion': 'off',
58+
// Allow unused arguments and variables when they begin with an underscore
59+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
60+
},
61+
},
62+
],
63+
};

.prettierrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

jsconfig.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,19 @@
1111
"resolveJsonModule": true,
1212
"sourceMap": true,
1313
"baseUrl": ".",
14-
"paths": {
15-
"@/*": ["src/*"]
16-
},
17-
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
14+
"lib": [
15+
"esnext",
16+
"dom",
17+
"dom.iterable",
18+
"scripthost"
19+
]
1820
},
19-
"include": ["src/**/*.ts", "src/**/*.vue"],
20-
"exclude": ["node_modules"]
21+
"include": [
22+
"src/**/*.ts",
23+
"src/**/*.js",
24+
"src/**/*.vue"
25+
],
26+
"exclude": [
27+
"node_modules"
28+
]
2129
}

0 commit comments

Comments
 (0)