]> git.openstreetmap.org Git - nominatim-ui.git/blob - eslint.config.mjs
Merge remote-tracking branch 'upstream/master'
[nominatim-ui.git] / eslint.config.mjs
1 import svelte from "eslint-plugin-svelte";
2 import mocha from "eslint-plugin-mocha";
3 import globals from "globals";
4 import path from "node:path";
5 import { fileURLToPath } from "node:url";
6 import js from "@eslint/js";
7 import { FlatCompat } from "@eslint/eslintrc";
8
9 const __filename = fileURLToPath(import.meta.url);
10 const __dirname = path.dirname(__filename);
11 const compat = new FlatCompat({
12     baseDirectory: __dirname,
13     recommendedConfig: js.configs.recommended,
14     allConfig: js.configs.all
15 });
16
17 export default [...compat.extends(
18     "airbnb-base/legacy",
19     "plugin:mocha/recommended",
20     "plugin:svelte/recommended",
21 ), {
22     plugins: {
23         svelte,
24         mocha,
25     },
26
27     languageOptions: {
28         globals: {
29             ...globals.browser,
30         },
31
32         ecmaVersion: 2019,
33         sourceType: "module",
34     },
35 }, {
36     files: ["**/*"],
37
38     languageOptions: {
39         globals: {
40             L: true,
41             Nominatim_Config: true,
42         },
43     },
44
45     rules: {
46         camelcase: "off",
47         "func-names": "off",
48         "vars-on-top": "off",
49         "new-cap": "off",
50         "no-multiple-empty-lines": "off",
51
52         "no-use-before-define": ["error", {
53             functions: false,
54         }],
55
56         "padded-blocks": "off",
57         "no-param-reassign": "off",
58
59         "max-len": ["error", 100, 2, {
60             ignoreUrls: true,
61         }],
62     },
63 }, {
64     files: ["test/**"],
65
66     languageOptions: {
67         globals: {
68             browser: true,
69         },
70     },
71 }];