Skip to content

Commit 637d92c

Browse files
committed
chore: add eslint flat config
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 4405279 commit 637d92c

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

eslint.config.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
2+
// SPDX-License-Identifier: AGPL-3.0-or-later
3+
4+
const js = require('@eslint/js')
5+
const vue = require('eslint-plugin-vue')
6+
const tsPlugin = require('@typescript-eslint/eslint-plugin')
7+
const tsParser = require('@typescript-eslint/parser')
8+
const vueParser = require('vue-eslint-parser')
9+
const vitest = require('eslint-plugin-vitest')
10+
11+
const vitestGlobals = {
12+
afterAll: 'readonly',
13+
afterEach: 'readonly',
14+
beforeAll: 'readonly',
15+
beforeEach: 'readonly',
16+
describe: 'readonly',
17+
expect: 'readonly',
18+
it: 'readonly',
19+
test: 'readonly',
20+
vi: 'readonly',
21+
}
22+
23+
module.exports = [
24+
{
25+
ignores: ['dist/**', 'dist-demo/**', 'node_modules/**'],
26+
},
27+
js.configs.recommended,
28+
{
29+
files: ['**/*.{js,ts,vue}'],
30+
languageOptions: {
31+
parser: vueParser,
32+
parserOptions: {
33+
parser: tsParser,
34+
ecmaVersion: 2021,
35+
sourceType: 'module',
36+
},
37+
},
38+
plugins: {
39+
vue,
40+
'@typescript-eslint': tsPlugin,
41+
},
42+
rules: {
43+
...vue.configs['flat/essential'].rules,
44+
...tsPlugin.configs.recommended.rules,
45+
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
46+
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
47+
},
48+
},
49+
{
50+
files: ['tests/**/*.ts'],
51+
plugins: {
52+
vitest,
53+
},
54+
languageOptions: {
55+
globals: vitestGlobals,
56+
},
57+
rules: {
58+
...(vitest.configs?.recommended?.rules || {}),
59+
},
60+
},
61+
]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
},
4848
"devDependencies": {
4949
"@nextcloud/browserslist-config": "^3.1.2",
50+
"@eslint/js": "^9.39.3",
5051
"@typescript-eslint/eslint-plugin": "^8.56.0",
5152
"@typescript-eslint/parser": "^8.56.0",
5253
"@vitejs/plugin-vue": "^6.0.4",

0 commit comments

Comments
 (0)