Skip to content

Commit 47b4e50

Browse files
authored
Merge pull request #385 from TypeFox/eslint
Integrate eslint with eslint-config-standard
2 parents 7b949a8 + 7924e09 commit 47b4e50

40 files changed

Lines changed: 4461 additions & 793 deletions

.eslintrc.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const path = require('path');
2+
const headerDef = path.resolve(__dirname, './packages/config/header.js');
3+
4+
module.exports = {
5+
env: {
6+
browser: true,
7+
es2020: true
8+
},
9+
extends: 'standard',
10+
globals: {
11+
},
12+
parser: '@typescript-eslint/parser',
13+
parserOptions: {
14+
ecmaVersion: '2020',
15+
sourceType: 'module',
16+
project: './tsconfig.json'
17+
},
18+
plugins: [
19+
'@typescript-eslint',
20+
'import',
21+
'unused-imports',
22+
'header'
23+
],
24+
rules: {
25+
indent: ['error', 4, {
26+
SwitchCase: 1
27+
}],
28+
semi: ['error', 'always'],
29+
'no-extra-semi': 'off',
30+
'@typescript-eslint/no-extra-semi': ['error'],
31+
'no-dupe-class-members': 'off',
32+
'@typescript-eslint/no-dupe-class-members': ['error'],
33+
'no-redeclare': 'off',
34+
'@typescript-eslint/no-redeclare': ['error'],
35+
'no-useless-constructor': 'warn',
36+
'no-void': 'warn',
37+
// Following recommendation:
38+
// https://typescript-eslint.io/docs/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
39+
'no-undef': 'off',
40+
'no-unused-vars': 'off',
41+
'@typescript-eslint/no-unused-vars': ['warn', {
42+
argsIgnorePattern: '^_'
43+
}],
44+
'header/header': [2, headerDef],
45+
'dot-notation': 'off',
46+
'@typescript-eslint/dot-notation': ['error']
47+
},
48+
ignorePatterns: ['.eslintrc.js', './packages/examples/browser-lsp/src/serverWorker.ts']
49+
};

.github/workflows/actions.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ jobs:
1717
- name: Build
1818
shell: bash
1919
run: |
20-
npm i && npm run build
20+
npm ci
21+
npm run build
22+
npm run lint

.vscode/settings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
"editor.formatOnSave": false,
55
"workbench.editor.revealIfOpen": true,
66
"[javascript]": {
7-
"editor.formatOnSave": true
7+
"editor.formatOnSave": true,
8+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
89
},
910
"[typescript]": {
10-
"editor.formatOnSave": true
11+
"editor.formatOnSave": true,
12+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
1113
},
1214
"eslint.validate": [
1315
"javascript",

0 commit comments

Comments
 (0)