configure eslint

This commit is contained in:
Johannes Theiner
2024-02-29 13:18:14 +01:00
parent e60294b950
commit b9a0e401e0
5 changed files with 94 additions and 52 deletions

View File

@@ -1,3 +1,2 @@
node_modules/
main.js
**/*.mjs

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"
}
}

56
eslint.config.mjs Normal file
View File

@@ -0,0 +1,56 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import globals from 'globals';
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
sourceType: "module",
parser: "@typescript-eslint/parser",
project: "./tsconfig.json",
},
globals: {
...globals.browser, ...globals.worker
}
},
rules: {
"no-unused-vars": "off",
"no-prototype-bultins": "off",
"no-self-compare": "warn",
"no-eval": "error",
"no-implied-eval": "error",
"prefer-const": "off",
"no-console": [
"warn",
{
"allow": ["warn", "error", "debug"]
}
],
"no-restricted-globals": [
"error",
{
"name": "app",
"message": "Avoid using the global app object. Instead use the reference provided by your plugin instance."
}
],
"no-alert": "error",
"no-undef": "error",
"@typescript/eslint-ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "none"
}
],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/await-thenable": "warn",
"@typescript-eslint/no-invalid-this": "error",
"@typescript-eslint/no-require-imports": "warn",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn"
}
},
);

View File

@@ -6,7 +6,8 @@
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
"version": "node version-bump.mjs && git add manifest.json versions.json"
"version": "node version-bump.mjs && git add manifest.json versions.json",
"lint": "eslint src"
},
"keywords": [],
"author": "",
@@ -15,10 +16,14 @@
"@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",
"obsidian": "latest",
"esbuild": "0.20.1",
"eslint": "8.57.0",
"typescript-eslint": "7.1.0",
"tslib": "2.4.0",
"typescript": "4.7.4"
"typescript": "4.7.4",
"globals": "14.0.0"
},
"dependencies": {
"obsidian": "latest"
}
}

View File

@@ -1,24 +1,29 @@
{
"compilerOptions": {
"baseUrl": ".",
"inlineSourceMap": true,
"inlineSources": true,
"module": "ESNext",
"target": "ES6",
"allowJs": true,
"noImplicitAny": true,
"moduleResolution": "node",
"importHelpers": true,
"isolatedModules": true,
"strictNullChecks": true,
"lib": [
"DOM",
"ES5",
"ES6",
"ES7"
]
},
"include": [
"**/*.ts"
]
"compilerOptions": {
"baseUrl": "src",
"inlineSourceMap": true,
"inlineSources": true,
"module": "ESNext",
"target": "ES6",
"allowJs": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"importHelpers": true,
"noUncheckedIndexedAccess": true,
"isolatedModules": true,
"strictNullChecks": true,
"strictBindCallApply": true,
"useUnknownInCatchVariables": true,
"lib": [
"DOM",
"ES5",
"ES6",
"ES7"
]
},
"include": [
"src/**/*.ts"
]
}