This repository was archived by the owner on Aug 15, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy patheslint.config.mjs
More file actions
64 lines (63 loc) 路 4.02 KB
/
Copy patheslint.config.mjs
File metadata and controls
64 lines (63 loc) 路 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import globals from 'globals'
import importPlugin from 'eslint-plugin-import-x'
import js from '@eslint/js'
import json from '@eslint/json'
import markdown from '@eslint/markdown'
import regexp from 'eslint-plugin-regexp'
import stylisticJS from '@stylistic/eslint-plugin'
export default [
{ ignores: ['**/*cache*', '**/*.min.{js,mjs}', '**/package-lock.json'] },
{
files: ['**/*.{js,mjs}'],
languageOptions: {
ecmaVersion: 'latest', sourceType: 'script',
globals: {
...globals.browser, ...globals.greasemonkey, ...globals.node, api: 'readonly', app: 'writable',
browserAPI: 'readonly', buttons: 'writable', chatgpt: 'readonly', chrome: 'readonly',
CryptoJS: 'readonly', css: 'readonly', dom: 'readonly', env: 'writable', feedback: 'readonly',
fontSizeSlider: 'writable', get: 'readonly', GM_cookie: 'readonly', gmToolbarMenu: 'writable',
hljs: 'readonly', i18n: 'readonly', icons: 'readonly', ipv4: 'readonly', JSON5: 'readonly',
log: 'readonly', logos: 'readonly', marked: 'readonly', menus: 'writable', modals: 'readonly',
prompts: 'readonly', renderMathInElement: 'readonly', replyBubble: 'writable', session: 'readonly',
settings: 'writable', show: 'readonly', string: 'readonly', themes: 'readonly', toggle: 'readonly',
Tone: 'readonly', tooltip: 'writable', ui: 'readonly', update: 'readonly', updateCheck: 'readonly',
userscript: 'readonly'
}
},
plugins: { 'import-x': importPlugin, 'js-styles': stylisticJS, regexp },
rules: {
...js.configs.recommended.rules,
...importPlugin.flatConfigs.recommended.rules,
...regexp.configs['flat/recommended'].rules,
'indent': 'off', 'no-unexpected-multiline': 'off', 'key-spacing': 'off', // allow whitespace anywhere
'js-styles/no-trailing-spaces': 'error', // ...except at ends of lines
'js-styles/max-len': ['error', { 'code': 120, // limit lines to 120 chars except if containing...
'ignoreComments': true, 'ignoreStrings': true, // ...trailing/own-line comments, quoted strings...
'ignoreTemplateLiterals': true, 'ignoreRegExpLiterals': true }], // ...or template/regex literals
'js-styles/no-extra-semi': 'error', // disallow unnecessary semicolons
'quotes': ['error', 'single', // enforce single quotes...
{ 'allowTemplateLiterals': true }], // ...except backticks to avoid escaping quotes
'comma-dangle': ['error', 'never'], // enforce no trailing commas in arrays or objects
'no-constant-condition': 'off', // allow constant conditions
'no-empty': 'off', // allow empty blocks
'no-inner-declarations': 'off', // allow function declarations anywhere
'no-unused-vars': ['error', { 'caughtErrors': 'none' }], // allow unused named args in catch blocks
'preserve-caught-error': 'off', // allow omit pass caught err as cause
'import-x/no-named-as-default-member': 'off', // allow accessing named exports via default import
'import-x/no-unresolved': ['error', { ignore: ['^(?:https?://)'] }] // allow dynamic imports from URLs
}
},
{ files: ['**/*.json'], language: 'json/json', ...json.configs.recommended },
{
files: ['**/*.md'], language: 'markdown/commonmark', plugins: { markdown },
rules: {
...markdown.configs.recommended[0].rules,
'markdown/heading-increment': 'off', // allow headings to skip levels
'markdown/fenced-code-language': 'off', // allow code blocks w/ no language specified
'markdown/no-missing-label-refs': 'off', // allow missing label references
'markdown/no-multiple-h1': 'off', // allow multi H1s
'markdown/require-alt-text': 'off' // allow missing img alts
}
},
{ files: ['**/*.mjs'], languageOptions: { sourceType: 'module' }}
]