From 1299d632bdc8b676d3fc2114a1788a2f8f63597c Mon Sep 17 00:00:00 2001 From: supahgreg Date: Sun, 12 Oct 2025 19:38:08 +0000 Subject: Get ESLint working and tweak the config (stricter). --- eslint.config.js | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 eslint.config.js (limited to 'eslint.config.js') diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000..f1fc76d28 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,80 @@ +import js from '@eslint/js'; + +export default [ + js.configs.recommended, + + { + files: ['js/**/*.js', 'plugins/**/*.js'], + languageOptions: { + ecmaVersion: 2022, + sourceType: 'script', + globals: { + // Browser + window: 'readonly', + document: 'readonly', + console: 'readonly', + alert: 'readonly', + confirm: 'readonly', + setTimeout: 'readonly', + setInterval: 'readonly', + clearTimeout: 'readonly', + clearInterval: 'readonly', + fetch: 'readonly', + XMLHttpRequest: 'readonly', + localStorage: 'readonly', + location: 'readonly', + history: 'readonly', + + // tt-rss + App: 'writable', + Article: 'writable', + CommonDialogs: 'writable', + CommonFilters: 'writable', + Feeds: 'writable', + FeedStoreModel: 'writable', + FeedTree: 'writable', + Headlines: 'writable', + PluginHost: 'writable', + PrefFeedStore: 'writable', + PrefFeedTree: 'writable', + PrefFilterStore: 'writable', + PrefFilterTree: 'writable', + PrefHelpers: 'writable', + PrefLabelTree: 'writable', + PrefUsers: 'writable', + SingleUseDialog: 'writable', + Toolbar: 'writable', + + // Dojo + dojo: 'readonly', + dijit: 'readonly' + } + }, + + rules: { + 'no-undef': 'warn', + 'no-unused-vars': 'warn', + 'no-console': 'off', + + 'prefer-const': 'error', + 'no-var': 'warn', + + 'eqeqeq': ['error', 'always'], + 'no-caller': 'error', + 'no-proto': 'error', + + 'linebreak-style': ['error', 'unix'], + 'eol-last': 'error', + 'no-trailing-spaces': 'error', + 'no-multiple-empty-lines': ['error', { 'max': 2 }], + + 'keyword-spacing': ['error', { 'after': true, 'before': true }], + 'block-spacing': ['error', 'always'], + 'computed-property-spacing': ['error', 'never'], + + 'no-empty': ['error', { 'allowEmptyCatch': true }], + + 'max-statements-per-line': ['warn', { 'max': 2 }] + } + } +]; -- cgit v1.2.3-54-g00ecf