Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Upgrade to ESLint 9 #33

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

49 changes: 0 additions & 49 deletions .eslintrc.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.* @NatoBoram
* @NatoBoram
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"source.organizeImports": "always"
},
"editor.formatOnSave": true,
"eslint.useFlatConfig": true,
"explorer.fileNesting.patterns": {
"*.js": "${capture}.d.ts, ${capture}.d.ts.map, ${capture}.js.map, ${capture}.min.js, ${capture}.test.d.ts.map",
"*.ts": "${capture}.test.ts, ${capture}.test.ts.map",
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ The most gigachad project setup for TypeScript.

## Publishing

This template offers a GitHub Workflow to help you automatically bump the version number, tag it, push it, and publish it to both NPM and the GitHub Package Registry on the click of a button.
This template offers a GitHub Workflow to help you automatically bump the version number, tag it, push it, and publish it to both NPM, the GitHub Package Registry and in GitHub Releases on the click of a button.

To make the `git push` work when signed commits are enforced (because you are a gigachad), you'll need to provide a SSH key.
To make the `git push` work, you'll need to use a [Deploy Key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys#deploy-keys).

1. Genereate a SSH key with <https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key>

Expand All @@ -37,6 +37,10 @@ To make the `git push` work when signed commits are enforced (because you are a
2. Add the private key to your project's secrets at `/settings/secrets/actions/new` with the name `DEPLOY_KEY_PRIVATE`
3. Add the public key to your project's variables at `/settings/variables/actions/new` with the name `DEPLOY_KEY_PUBLIC`
4. Add the public key to your project's deploy keys at `/settings/keys`
5. Add the public key to `.github/authorized_keys` in the format of `41898282+github-actions[bot]@users.noreply.github.com <DEPLOY_KEY_PUBLIC>` while replacing `<DEPLOY_KEY_PUBLIC>` with your public key
6. Delete the key pair from your computer, never to be seen again

The `.github/authorized_keys` is used to sign and verify the signature of the build artefact that is sent to GitHub Releases. If you want to skip this step, you can remove it from `.github/workflows/pnpm-publish.yaml`.

To publish on NPM, you'll need to provide your NPM token.

Expand Down
72 changes: 72 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import eslint from "@eslint/js"
import prettier from "eslint-config-prettier"
import globals from "globals"
import tseslint from "typescript-eslint"

/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */

export default tseslint.config(
{
languageOptions: {
globals: { ...globals.browser, ...globals.node },
parserOptions: { project: "./tsconfig.eslint.json" },
},
},

eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
prettier,

{
rules: {
"@typescript-eslint/class-methods-use-this": [
"error",
{
ignoreClassesThatImplementAnInterface: true,
ignoreOverrideMethods: true,
},
],
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{ fixStyle: "separate-type-imports" },
],
"@typescript-eslint/default-param-last": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{ accessibility: "no-public" },
],
"@typescript-eslint/method-signature-style": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-useless-empty-export": "error",
"@typescript-eslint/prefer-nullish-coalescing": [
"error",
{ ignorePrimitives: true },
],
"@typescript-eslint/prefer-readonly": "error",
"@typescript-eslint/prefer-regexp-exec": "error",
"@typescript-eslint/promise-function-async": [
"error",
{ checkArrowFunctions: false },
],
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/return-await": "error",
"@typescript-eslint/sort-type-constituents": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"func-style": ["error", "declaration"],
},
},
{
ignores: [
".pnpm-store/",
"dist/",
"docs/",
"node_modules/",
"package-lock.json",
"pnpm-lock.yaml",
],
},
)
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@
"test": "vitest"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"eslint": "^8.57.0",
"@eslint/js": "^9.1.1",
"eslint": "^9.1.1",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.0.0",
"prettier": "^3.2.5",
"tsx": "^4.7.1",
"typedoc": "^0.25.12",
"typescript": "~5.4.3",
"typescript-eslint": "^7.7.1",
"vitest": "^1.4.0"
},
"type": "module",
Expand Down
Loading
Loading