Skip to content

Commit 13a3930

Browse files
authored
Merge pull request #75 from bobur-khay/chore/add-linting-rules_#46
Linting Rules
2 parents 8e390db + 2c5b8aa commit 13a3930

13 files changed

Lines changed: 580 additions & 182 deletions

.eslintrc.json

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,42 @@
55
"node": true,
66
"jest": true
77
},
8+
"parser": "@typescript-eslint/parser",
89
"parserOptions": {
910
"ecmaVersion": 8
1011
},
11-
"extends": ["eslint:recommended", "prettier"],
12-
"ignorePatterns": ["dist", "node_modules", "bin"]
12+
"plugins": ["@typescript-eslint", "unused-imports"],
13+
"extends": ["eslint:recommended", "prettier", "plugin:@typescript-eslint/recommended"],
14+
"ignorePatterns": ["dist", "node_modules", "bin"],
15+
"rules": {
16+
// default rules are overriden by the plugins
17+
"no-unused-vars": "off",
18+
"no-use-before-define": "off",
19+
"@typescript-eslint/no-unused-vars": "off",
20+
21+
"guard-for-in": "error",
22+
"@typescript-eslint/no-use-before-define": [
23+
"error",
24+
{
25+
"functions": false,
26+
"classes": true,
27+
"variables": true,
28+
"enums": true,
29+
"typedefs": true
30+
}
31+
],
32+
"@typescript-eslint/no-require-imports": "off",
33+
"unused-imports/no-unused-imports": "error",
34+
"unused-imports/no-unused-vars": [
35+
"warn",
36+
{
37+
"vars": "all",
38+
"varsIgnorePattern": "^_",
39+
"args": "after-used",
40+
"argsIgnorePattern": "^_",
41+
"caughtErrors": "all",
42+
"caughtErrorsIgnorePattern": "^_"
43+
}
44+
]
45+
}
1346
}

.github/workflows/eslint.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ jobs:
2828
- name: Checkout code
2929
uses: actions/checkout@v4
3030

31-
- name: Install ESLint
32-
run: |
33-
npm install eslint@8.10.0
34-
npm install @microsoft/eslint-formatter-sarif@2.1.7
35-
npm install eslint-config-prettier@8.8.0
31+
- name: Install dependencies
32+
run: npm ci
3633

3734
- name: Run ESLint
3835
run: "npm run lint:sarif"

node/aas-aid/package-lock.json

Lines changed: 89 additions & 111 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/aas-aid/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
"@types/debug": "^4.1.12",
3535
"@types/mocha": "^9.0.0",
3636
"chai": "^4.3.4",
37-
"mocha": "^9.2.2",
37+
"mocha": "^10.8.2",
3838
"nyc": "^17.0.0",
3939
"ts-node": "^10.9.1",
4040
"typescript": "4.7.4"
4141
},
4242
"scripts": {
4343
"build": "tsc -b",
44-
"test": "mocha --require ts-node/register --extension ts",
45-
"test:coverage": "nyc --reporter=lcov mocha --require ts-node/register --extension ts"
44+
"test": "mocha --node-option loader=ts-node/esm --require ts-node/register --extension ts",
45+
"test:coverage": "nyc --reporter=lcov mocha --node-option loader=ts-node/esm --require ts-node/register --extension ts"
4646
},
4747
"bugs": {
4848
"url": "https://github.com/eclipse-thingweb/td-tools/issues"

0 commit comments

Comments
 (0)