Skip to content

style: add eslint #237

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

Merged
merged 9 commits into from
Aug 8, 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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Node.js CI
on: [push]

jobs:
prettier:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -14,7 +14,7 @@ jobs:
cache: yarn
cache-dependency-path: "**/yarn.lock"
- run: yarn install
- run: yarn prettier --check .
- run: yarn lint

build:
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ import "normally-transformed"; // This will remain 'normally-transformed', even
## Project Guidelines for Contributors

- Package Manager: `yarn` (`yarn install`)
- Format before commit: `prettier` (`yarn format`)
- Format and lint the code before commit: `prettier` (`yarn format && yarn lint`)
- Commit messages: [Conventional Commit Specs](https://www.conventionalcommits.org/en/v1.0.0/)
- Releases: `changelogen` (`yarn release`)

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

export default [
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{ ignores: ["**/dist/", "src/declarations/", "test/projects/"] },
{ languageOptions: { globals: globals.node } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
rules: {
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-empty-object-type": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "warn",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unsafe-function-type": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"no-case-declarations": "warn",
"no-empty": "warn",
"no-useless-escape": "warn",
"prefer-const": "off",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
},
},
];
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"release": "changelogen --release --push",
"--------------": "",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"clean": "rm -rf \"**/dist\"",
"clean:all": "yarn clean && rm -rf node_modules \"**/node_modules\" \"**/yarn.lock\" yarn.lock",
"reset": "yarn clean:all && yarn install && yarn build",
Expand Down Expand Up @@ -53,15 +54,20 @@
"nx-transformer.js"
],
"devDependencies": {
"@eslint/js": "^9.8.0",
"@tsconfig/node18": "^18.2.4",
"@types/eslint": "^9",
"@types/minimatch": "^5.1.2",
"@types/node": "^18.19.43",
"@types/ts-expose-internals": "npm:[email protected]",
"@types/ts-node": "npm:ts-node@^10.9.2",
"changelogen": "^0.5.5",
"eslint": "9.x",
"globals": "^15.9.0",
"prettier": "^3.3.3",
"ts-patch": "^3.2.1",
"typescript": "^5.5.4"
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.1"
},
"peerDependencies": {
"typescript": ">=3.6.5"
Expand Down
Loading
Loading