add eslint

master
Matthew 2024-10-25 16:56:23 -04:00
parent 2dc23b5298
commit 43709e07f9
Signed by: matthew
SSH Key Fingerprint: SHA256:piIXekA9q1p0ZGi4ogFbNY1embip5Ytbi3v8AZ8UYq4
2 changed files with 56 additions and 1 deletions

27
.eslintrc.js Normal file
View File

@ -0,0 +1,27 @@
module.exports = {
env: {
node: true,
},
// Specify the parser for TypeScript
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: "module", // Allows for the use of imports
},
// existing ESLint configuration
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended", // Adds the Prettier plugin
],
plugins: ['@typescript-eslint', 'prettier'],
rules: {
"prettier/prettier": "error", // Displays Prettier errors as ESLint errors
prefer_const: "warn", // prefers using "const" for variables that are not reassigned
no_var: "error", // disallows the use of "var", must use "let" or "const" only
// TS rules
"@typescript-eslint/no-explicit-any": "warn", // Warns when using "any" type
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], // warns against any used variables except those prefixed with "_"
},
};

View File

@ -1,8 +1,20 @@
{ {
"license": "AGPL-3.0-or-later",
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.13.0",
"@types/uuid": "^9.0.8", "@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.11.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.4.2" "typescript": "^5.4.2",
"typescript-eslint": "^8.11.0"
}, },
"dependencies": { "dependencies": {
"@typegoose/typegoose": "^12.2.0", "@typegoose/typegoose": "^12.2.0",
@ -11,5 +23,21 @@
"stripe": "^14.21.0", "stripe": "^14.21.0",
"typeorm": "^0.3.20", "typeorm": "^0.3.20",
"uuid": "^9.0.1" "uuid": "^9.0.1"
},
"scripts": {
"prepare": "husky",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
"format": "prettier --write .",
"test": ""
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
],
"*.{json,css,scss,md}": [
"prettier --write"
]
} }
} }