|
| 1 | +import { defineConfig, globalIgnores } from 'eslint/config'; |
| 2 | +import globals from 'globals'; |
| 3 | +import markdown from "@eslint/markdown"; |
| 4 | +import json from '@eslint/json'; |
| 5 | +import js from '@eslint/js'; |
| 6 | + |
| 7 | +export default defineConfig([ |
| 8 | + globalIgnores([ |
| 9 | + 'node_modules', |
| 10 | + ]), |
| 11 | + // Markdown |
| 12 | + { |
| 13 | + files: ["**/*.md"], |
| 14 | + plugins: { |
| 15 | + markdown, |
| 16 | + }, |
| 17 | + processor: "markdown/markdown", |
| 18 | + }, |
| 19 | + // applies only to JavaScript blocks inside of Markdown files |
| 20 | + { |
| 21 | + files: ["**/*.md/*.js"], |
| 22 | + rules: { |
| 23 | + strict: "off", |
| 24 | + }, |
| 25 | + }, |
| 26 | + // JSON files |
| 27 | + { |
| 28 | + files: ['**/*.json'], |
| 29 | + ignores: ['package-lock.json'], |
| 30 | + plugins: { json }, |
| 31 | + language: 'json/json', |
| 32 | + extends: ['json/recommended'], |
| 33 | + rules: { |
| 34 | + 'json/no-duplicate-keys': 'error', |
| 35 | + }, |
| 36 | + }, |
| 37 | + // JavaScript files |
| 38 | + { |
| 39 | + files: ['**/*.js'], |
| 40 | + language: '@/js', |
| 41 | + plugins: { js }, |
| 42 | + extends: ['js/recommended'], |
| 43 | + linterOptions: { |
| 44 | + reportUnusedDisableDirectives: "off", |
| 45 | + }, |
| 46 | + languageOptions: { |
| 47 | + sourceType: 'script', |
| 48 | + ecmaVersion: 2026, |
| 49 | + globals: { |
| 50 | + ...globals.browser, |
| 51 | + /* LuCI runtime / cbi exports */ |
| 52 | + _: 'readonly', |
| 53 | + N_: 'readonly', |
| 54 | + L: 'readonly', |
| 55 | + E: 'readonly', |
| 56 | + TR: 'readonly', |
| 57 | + cbi_d: 'readonly', |
| 58 | + cbi_strings: 'readonly', |
| 59 | + cbi_d_add: 'readonly', |
| 60 | + cbi_d_check: 'readonly', |
| 61 | + cbi_d_checkvalue: 'readonly', |
| 62 | + cbi_d_update: 'readonly', |
| 63 | + cbi_init: 'readonly', |
| 64 | + cbi_update_table: 'readonly', |
| 65 | + cbi_validate_form: 'readonly', |
| 66 | + cbi_validate_field: 'readonly', |
| 67 | + cbi_validate_named_section_add: 'readonly', |
| 68 | + cbi_validate_reset: 'readonly', |
| 69 | + cbi_row_swap: 'readonly', |
| 70 | + cbi_tag_last: 'readonly', |
| 71 | + cbi_submit: 'readonly', |
| 72 | + cbi_dropdown_init: 'readonly', |
| 73 | + isElem: 'readonly', |
| 74 | + toElem: 'readonly', |
| 75 | + matchesElem: 'readonly', |
| 76 | + findParent: 'readonly', |
| 77 | + sfh: 'readonly', |
| 78 | + renderBadge: 'readonly', |
| 79 | + /* modules */ |
| 80 | + baseclass: 'readonly', |
| 81 | + dom: 'readonly', |
| 82 | + firewall: 'readonly', |
| 83 | + fwtool: 'readonly', |
| 84 | + form: 'readonly', |
| 85 | + fs: 'readonly', |
| 86 | + network: 'readonly', |
| 87 | + nettools: 'readonly', |
| 88 | + poll: 'readonly', |
| 89 | + random: 'readonly', |
| 90 | + request: 'readonly', |
| 91 | + session: 'readonly', |
| 92 | + rpc: 'readonly', |
| 93 | + uci: 'readonly', |
| 94 | + ui: 'readonly', |
| 95 | + uqr: 'readonly', |
| 96 | + validation: 'readonly', |
| 97 | + view: 'readonly', |
| 98 | + widgets: 'readonly', |
| 99 | + /* dockerman */ |
| 100 | + dm2: 'readonly', |
| 101 | + jsapi: 'readonly', |
| 102 | + }, |
| 103 | + parserOptions: { |
| 104 | + ecmaFeatures: { |
| 105 | + globalReturn: true, |
| 106 | + }, |
| 107 | + }, |
| 108 | + }, |
| 109 | + rules: { |
| 110 | + 'strict': 0, |
| 111 | + 'no-prototype-builtins': 0, |
| 112 | + 'no-empty': 0, |
| 113 | + 'no-undef': 'warn', |
| 114 | + 'no-unused-vars': ['off', { "caughtErrors": "none" }], |
| 115 | + 'no-regex-spaces': 0, |
| 116 | + 'no-control-regex': 0, |
| 117 | + }, |
| 118 | + }, |
| 119 | +]); |
0 commit comments