Skip to content

Commit

Permalink
Upgrade TypeScript and ESLint (#79)
Browse files Browse the repository at this point in the history
mcous authored Apr 14, 2023
1 parent bfc489d commit b992c2e
Showing 7 changed files with 4,003 additions and 769 deletions.
73 changes: 68 additions & 5 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,75 @@
# ESLint config
# http://eslint.org/docs/user-guide/configuring
# https://jstools.dev/eslint-config/

root: true

extends:
- "@jsdevtools"
- "eslint:recommended"
- "plugin:@typescript-eslint/recommended"
- "plugin:@typescript-eslint/recommended-requiring-type-checking"
- "plugin:@typescript-eslint/strict"
- "plugin:import/recommended"
- "plugin:import/typescript"
- "plugin:jsdoc/recommended-typescript"
- "plugin:n/recommended"
- "plugin:promise/recommended"
- "plugin:sonarjs/recommended"
- "plugin:unicorn/recommended"
- "prettier"

parserOptions:
project:
- "tsconfig.eslint.json"

settings:
import/resolver:
typescript: true
node: true

env:
es2021: true
node: true

overrides:
- files: ["**/*.js"]
rules:
"@typescript-eslint/no-var-requires": "off"
"unicorn/prefer-module": "off"

- files: ["test/**/*"]
env:
mocha: true
rules:
sonarjs/no-duplicate-string: "off"

rules:
n/no-unpublished-import: ["error", { "allowModules": ["@actions/core"] }]

# temporary rule overrides
# TODO(mc, 2023-04-12): fix problems, remove overrides, and remove --quiet
prefer-const: "warn"
no-regex-spaces: "warn"
"@typescript-eslint/no-floating-promises": "warn"
"@typescript-eslint/no-unsafe-argument": "warn"
"@typescript-eslint/no-unsafe-assignment": "warn"
"@typescript-eslint/no-unsafe-call": "warn"
"@typescript-eslint/no-unsafe-member-access": "warn"
"@typescript-eslint/no-unsafe-return": "warn"
"@typescript-eslint/require-await": "warn"
"@typescript-eslint/restrict-plus-operands": "warn"
"@typescript-eslint/restrict-template-expressions": "warn"
"@typescript-eslint/unbound-method": "warn"
n/no-missing-import: "warn"
n/no-missing-require: "warn"
n/no-process-exit: "warn"
unicorn/better-regex: "warn"
unicorn/catch-error-name: "warn"
unicorn/import-style: "warn"
unicorn/no-array-push-push: "warn"
unicorn/no-process-exit: "warn"
unicorn/no-useless-undefined: "warn"
unicorn/prefer-export-from: "warn"
unicorn/prefer-module: "warn"
unicorn/prefer-node-protocol: "warn"
unicorn/prefer-optional-catch-binding: "warn"
unicorn/prefer-spread: "warn"
unicorn/prefer-top-level-await: "warn"
unicorn/prevent-abbreviations: "warn"
unicorn/text-encoding-identifier-case: "warn"
1 change: 1 addition & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4,625 changes: 3,882 additions & 743 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 14 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -35,11 +35,11 @@
"lint": "npm run _eslint && npm run _prettier -- --check",
"format": "npm run _eslint -- --fix && npm run _prettier -- --write",
"build": "concurrently -g npm:build:*",
"build:lib": "tsc",
"build:dist": "esbuild src/action/index.ts --bundle --sourcemap --outdir=dist --platform=node --target=node16",
"build:lib": "tsc",
"test": "mocha",
"coverage": "nyc npm run test",
"_eslint": "eslint \"**/*.@(js|ts)\"",
"_eslint": "eslint --quiet \"**/*.@(js|ts)\"",
"_prettier": "prettier \"**/*.@(js|ts|json|md|yml)\""
},
"engines": {
@@ -48,21 +48,29 @@
"devDependencies": {
"@actions/core": "^1.10.0",
"@jsdevtools/chai-exec": "^2.1.1",
"@jsdevtools/eslint-config": "^1.1.4",
"@types/chai": "^4.2.14",
"@types/chai": "^4.3.4",
"@types/command-line-args": "^5.0.0",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"chai": "^4.3.7",
"concurrently": "^8.0.1",
"esbuild": "0.17.16",
"eslint": "^7.17.0",
"eslint": "^8.38.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "npm:eslint-plugin-i@^2.27.5-1",
"eslint-plugin-jsdoc": "^41.1.1",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-sonarjs": "^0.19.0",
"eslint-plugin-unicorn": "^46.0.0",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"prettier": "^2.8.7",
"shx": "^0.3.3",
"typescript": "^4.1.3"
"typescript": "^5.0.4"
},
"dependencies": {
"@jsdevtools/ez-spawn": "^3.0.4",
7 changes: 7 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.js"]
}
44 changes: 30 additions & 14 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
{
"compilerOptions": {
"target": "esnext",
// target Node v16 / ES2021
"target": "es2021",
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,

// Interoperability with CommonJS modules
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,

"rootDir": "src",
"outDir": "lib",
"sourceMap": true,
"declaration": true,
// Do not error out for errors in third-party modules
"skipLibCheck": true,

"newLine": "LF",
"forceConsistentCasingInFileNames": true,
// Type-checking options
"strict": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
// "exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictBindCallApply": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"stripInternal": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
// "noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,

// inputs and outputs
"declaration": true,
"sourceMap": true,
"rootDir": "src",
"outDir": "lib",

"typeRoots": ["node_modules/@types"]
// temporary overrides
// TODO(mc, 2023-04-12): fix errors and remove overrides
"useUnknownInCatchVariables": false,
"exactOptionalPropertyTypes": false,
"noPropertyAccessFromIndexSignature": false
},
"include": ["src/**/*.ts"]
}

0 comments on commit b992c2e

Please sign in to comment.