Update packages, and migrate eslint configuration

This updates the eslint configuration to the new flat file format, which
is the future format.

Also adds eslint as a dev dependency. JS Projects should have locally
installed the correct versions of development tools like
eslint/prettier, etc. So developer experience is consistent; and not
depending on external context, like globally installed versions; but the
version that matches the configuration.

Also updates outdated packages, like typescript

Would have liked to update to eslint@9, but the typescript module does
not yet support 9 as a peer dependency.
This commit is contained in:
Peter Strøiman 2024-07-30 14:30:31 +02:00
parent e60294b950
commit 4c794f807e
5 changed files with 2234 additions and 32 deletions

View File

@ -1,3 +0,0 @@
node_modules/
main.js

View File

@ -1,23 +0,0 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
}
}

49
eslint.config.mjs Normal file
View File

@ -0,0 +1,49 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [{
ignores: ["**/node_modules/", "**/main.js"],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
), {
plugins: {
"@typescript-eslint": typescriptEslint,
},
languageOptions: {
globals: {
...globals.node,
},
parser: tsParser,
ecmaVersion: 5,
sourceType: "module",
},
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", {
args: "none",
}],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off",
},
}];

2175
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -12,13 +12,17 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0",
"esbuild": "0.17.3",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.18.0",
"builtin-modules": "^4.0.0",
"esbuild": "^0.23.0",
"eslint": "^8.57.0",
"globals": "^15.8.0",
"obsidian": "latest",
"tslib": "2.4.0",
"typescript": "4.7.4"
"tslib": "2.6",
"typescript": "^5.5.2"
}
}