Skip to content

Commit

Permalink
ci: add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieter Stinglhamber committed Dec 19, 2023
1 parent 6f853f5 commit ca2d717
Show file tree
Hide file tree
Showing 12 changed files with 3,044 additions and 135 deletions.
54 changes: 54 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module.exports = {
extends: [
'eslint:recommended',
'airbnb-typescript/base',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:import/recommended',
'plugin:node/recommended',
],
parserOptions: {
project: ['./tsconfig.eslint.json'],
},
env: {
es6: true,
jest: true,
node: true,
},
rules: {
'node/no-unsupported-features/es-syntax': [
'error',
{ ignores: ['modules'] },
],
// @see: https://github.com/typescript-eslint/typescript-eslint/issues/1824
'@typescript-eslint/indent': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
'import/no-duplicates': ['error', { 'prefer-inline': true }],
'import/order': 'error',
'no-plusplus': 'off',
'node/no-missing-import': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true },
],
'import/no-anonymous-default-export': [
'error',
{
allowArray: true,
allowArrowFunction: false,
allowAnonymousClass: false,
allowAnonymousFunction: false,
allowCallExpression: true,
allowLiteral: true,
allowObject: true,
},
],
},
};
4 changes: 2 additions & 2 deletions .github/workflows/check-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
check-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/publish.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run commitlint ${1}
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
20 changes: 17 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
"prepare": "husky install",
"preinstall": "npx only-allow pnpm",
"test": "jest",
"lint": "prettier --check .",
"lint:fix": "prettier --write .",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"check:types": "tsc --noEmit",
"build": "tsc"
"build": "tsc",
"commitlint": "commitlint --edit"
},
"keywords": [
"asyncapi",
Expand All @@ -45,9 +46,22 @@
"ajv-formats": "^2.1.1"
},
"devDependencies": {
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@tsconfig/node20": "^20.1.2",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.5",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-check-file": "^2.6.2",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.3",
"jest": "^29.7.0",
"lint-staged": "^15.2.0",
Expand Down
Loading

0 comments on commit ca2d717

Please sign in to comment.