JS: Upated npm deps, upgraded eslint, new eslint config

Upgraded eslint to 11, removed incompatible airbnb config as part of
process. ESlint config now in its own file.
This commit is contained in:
Dan Brown 2025-02-23 11:55:09 +00:00
parent c3a1fabbf0
commit 6548ea4a12
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
4 changed files with 2155 additions and 1323 deletions

64
eslint.config.mjs Normal file
View File

@ -0,0 +1,64 @@
import globals from 'globals';
import js from '@eslint/js';
export default [
js.configs.recommended,
{
ignores: ['resources/**/*-stub.js', 'resources/**/*.ts'],
}, {
languageOptions: {
globals: {
...globals.browser,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
indent: ['error', 4],
'arrow-parens': ['error', 'as-needed'],
'padded-blocks': ['error', {
blocks: 'never',
classes: 'always',
}],
'object-curly-spacing': ['error', 'never'],
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'import/prefer-default-export': 'off',
'no-plusplus': ['error', {
allowForLoopAfterthoughts: true,
}],
'arrow-body-style': 'off',
'no-restricted-syntax': 'off',
'no-continue': 'off',
'prefer-destructuring': 'off',
'class-methods-use-this': 'off',
'no-param-reassign': 'off',
'no-console': ['warn', {
allow: ['error', 'warn'],
}],
'no-new': 'off',
'max-len': ['error', {
code: 110,
tabWidth: 4,
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
}],
},
}];

3307
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,36 +19,36 @@
"test": "jest"
},
"devDependencies": {
"@eslint/js": "^9.21.0",
"@lezer/generator": "^1.7.2",
"@types/sortablejs": "^1.15.8",
"chokidar-cli": "^3.0",
"esbuild": "^0.24.0",
"eslint": "^8.57.1",
"eslint-config-airbnb-base": "^15.0.0",
"esbuild": "^0.25.0",
"eslint": "^9.21.0",
"eslint-plugin-import": "^2.31.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"livereload": "^0.9.3",
"npm-run-all": "^4.1.5",
"sass": "^1.82.0",
"ts-jest": "^29.2.5",
"sass": "^1.85.0",
"ts-jest": "^29.2.6",
"ts-node": "^10.9.2",
"typescript": "5.7.*"
},
"dependencies": {
"@codemirror/commands": "^6.7.1",
"@codemirror/commands": "^6.8.0",
"@codemirror/lang-css": "^6.3.1",
"@codemirror/lang-html": "^6.4.9",
"@codemirror/lang-javascript": "^6.2.2",
"@codemirror/lang-javascript": "^6.2.3",
"@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-markdown": "^6.3.1",
"@codemirror/lang-markdown": "^6.3.2",
"@codemirror/lang-php": "^6.0.1",
"@codemirror/lang-xml": "^6.1.0",
"@codemirror/language": "^6.10.6",
"@codemirror/legacy-modes": "^6.4.2",
"@codemirror/state": "^6.5.0",
"@codemirror/language": "^6.10.8",
"@codemirror/legacy-modes": "^6.4.3",
"@codemirror/state": "^6.5.2",
"@codemirror/theme-one-dark": "^6.1.2",
"@codemirror/view": "^6.35.2",
"@codemirror/view": "^6.36.3",
"@lezer/highlight": "^1.2.1",
"@ssddanbrown/codemirror-lang-smarty": "^1.0.0",
"@ssddanbrown/codemirror-lang-twig": "^1.0.0",
@ -59,86 +59,5 @@
"markdown-it-task-lists": "^2.1.1",
"snabbdom": "^3.6.2",
"sortablejs": "^1.15.6"
},
"eslintConfig": {
"root": true,
"env": {
"browser": true,
"es2021": true
},
"extends": "airbnb-base",
"ignorePatterns": [
"resources/**/*-stub.js",
"resources/**/*.ts"
],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"indent": [
"error",
4
],
"arrow-parens": [
"error",
"as-needed"
],
"padded-blocks": [
"error",
{
"blocks": "never",
"classes": "always"
}
],
"object-curly-spacing": [
"error",
"never"
],
"space-before-function-paren": [
"error",
{
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}
],
"import/prefer-default-export": "off",
"no-plusplus": [
"error",
{
"allowForLoopAfterthoughts": true
}
],
"arrow-body-style": "off",
"no-restricted-syntax": "off",
"no-continue": "off",
"prefer-destructuring": "off",
"class-methods-use-this": "off",
"no-param-reassign": "off",
"no-console": [
"warn",
{
"allow": [
"error",
"warn"
]
}
],
"no-new": "off",
"max-len": [
"error",
{
"code": 110,
"tabWidth": 4,
"ignoreUrls": true,
"ignoreComments": false,
"ignoreRegExpLiterals": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true
}
]
}
}
}

View File

@ -138,7 +138,7 @@ export class PageEditor extends Component {
didSave = true;
this.autoSave.pendingChange = false;
} catch (err) {
} catch {
// Save the editor content in LocalStorage as a last resort, just in case.
try {
const saveKey = `draft-save-fail-${(new Date()).toISOString()}`;