chore: migrate to ESLint flat config (#11205)

This commit is contained in:
Lucian Mocanu 2024-12-29 17:33:46 +02:00 committed by GitHub
parent 67c896ff11
commit af7ac1c6d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 516 additions and 644 deletions

View File

@ -1,29 +0,0 @@
{
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"ignorePatterns": ["*.d.ts"],
"rules": {
"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-loss-of-precision": "warn",
"@typescript-eslint/no-misused-new": "warn",
"@typescript-eslint/no-namespace": "warn",
"@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
"@typescript-eslint/no-unsafe-declaration-merging": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-var-requires": "warn",
"@typescript-eslint/triple-slash-reference": "warn",
"no-async-promise-executor": "warn",
"no-control-regex": "warn",
"no-empty": "warn",
"no-extra-semi": "warn",
"no-prototype-builtins": "warn",
"no-regex-spaces": "warn",
"prefer-const": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn"
}
}

51
eslint.config.mjs Normal file
View File

@ -0,0 +1,51 @@
import eslint from "@eslint/js"
import tseslint from "typescript-eslint"
import globals from "globals"
export default tseslint.config({
files: ["**/*.ts"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: "tsconfig.json",
},
globals: {
...globals.browser,
...globals.node,
},
},
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
rules: {
// exceptions
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-empty-object-type": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-misused-new": "warn",
"@typescript-eslint/no-namespace": "warn",
"@typescript-eslint/no-require-imports": "warn",
"@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
"@typescript-eslint/no-unsafe-declaration-merging": "warn",
"@typescript-eslint/no-unsafe-function-type": "warn",
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/no-wrapper-object-types": "warn",
"@typescript-eslint/triple-slash-reference": "warn",
"no-async-promise-executor": "warn",
"no-control-regex": "warn",
"no-empty": "warn",
"no-loss-of-precision": "warn",
"no-prototype-builtins": "warn",
"no-regex-spaces": "warn",
// custom
"prefer-const": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
// deprecated: stylistic
"no-extra-semi": "warn",
},
})

1062
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -93,6 +93,7 @@
"cloud-spanner-orm"
],
"devDependencies": {
"@eslint/js": "^9.17.0",
"@tsconfig/node16": "^16.1.1",
"@types/app-root-path": "^1.2.4",
"@types/chai": "^4.3.4",
@ -108,7 +109,6 @@
"@types/source-map-support": "^0.5.6",
"@types/uuid": "^9.0.0",
"@types/yargs": "^17.0.22",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"better-sqlite3": "^8.1.0",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
@ -116,7 +116,8 @@
"conventional-changelog-angular": "^5.0.13",
"conventional-changelog-cli": "^2.2.2",
"del": "6.1.1",
"eslint": "^8.44.0",
"eslint": "^9.17.0",
"globals": "^15.14.0",
"gulp": "^4.0.2",
"gulp-istanbul": "^1.1.3",
"gulp-mocha": "^10.0.0",
@ -134,7 +135,7 @@
"mysql2": "^3.9.7",
"pg": "^8.9.0",
"pg-query-stream": "^4.3.0",
"prettier": "^2.8.3",
"prettier": "^2.8.8",
"redis": "^4.6.4",
"remap-istanbul": "^0.13.0",
"rimraf": "^4.1.2",
@ -145,7 +146,8 @@
"sqlite3": "^5.1.4",
"ts-node": "^10.9.2",
"typeorm-aurora-data-api-driver": "^2.4.4",
"typescript": "^5.3.3"
"typescript": "^5.7.2",
"typescript-eslint": "^8.18.1"
},
"peerDependencies": {
"@google-cloud/spanner": "^5.18.0",
@ -243,7 +245,7 @@
"watch": "./node_modules/.bin/tsc -w",
"package": "gulp package",
"pack": "gulp pack",
"lint": "eslint . --ext .ts",
"lint": "eslint .",
"format": "prettier --write --end-of-line auto \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2"
},

View File

@ -47,7 +47,7 @@ export class BetterSqlite3QueryRunner extends AbstractSqliteQueryRunner {
while (this.stmtCache.size > this.cacheSize) {
// since es6 map keeps the insertion order,
// it comes to be FIFO cache
const key = this.stmtCache.keys().next().value
const key = this.stmtCache.keys().next().value!
this.stmtCache.delete(key)
}
}

View File

@ -26,7 +26,7 @@ describe("github issues > #799 sqlite: 'database' path should be created", () =>
)
if (isEnabled === false) return
const dataSource = new DataSource({
dataSource = new DataSource({
name: "sqlite",
type: "sqlite",
database: path,
@ -43,7 +43,7 @@ describe("github issues > #799 sqlite: 'database' path should be created", () =>
)
if (isEnabled === false) return
const dataSource = new DataSource({
dataSource = new DataSource({
name: "better-sqlite3",
type: "better-sqlite3",
database: path,