Skip to content

Commit d032d31

Browse files
committed
introduce ESLint and Prettier
1 parent c511a6e commit d032d31

22 files changed

+2606
-2510
lines changed

.eslintignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules/
2+
dist/
3+
out/
4+
coverage/
5+
6+
vscode.d.ts
7+
vscode.proposed.d.ts
8+
9+
.mypy_cache/
10+
.pytest_cache/

.eslintrc

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"es6": true,
5+
"mocha": true
6+
},
7+
"parser": "@typescript-eslint/parser",
8+
"plugins": ["@typescript-eslint", "prettier"],
9+
"extends": [
10+
"standard",
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:import/errors",
13+
"plugin:import/warnings",
14+
"plugin:import/typescript",
15+
"prettier"
16+
],
17+
"rules": {
18+
// Overriding ESLint rules with Typescript-specific ones
19+
"@typescript-eslint/ban-ts-comment": [
20+
"error",
21+
{
22+
"ts-ignore": "allow-with-description"
23+
}
24+
],
25+
"@typescript-eslint/explicit-module-boundary-types": "error",
26+
"no-bitwise": "off",
27+
"no-dupe-class-members": "off",
28+
"@typescript-eslint/no-dupe-class-members": "error",
29+
"no-empty-function": "off",
30+
"@typescript-eslint/no-empty-function": ["error"],
31+
"@typescript-eslint/no-empty-interface": "off",
32+
"@typescript-eslint/no-explicit-any": "error",
33+
"@typescript-eslint/no-non-null-assertion": "off",
34+
"no-unused-vars": "off",
35+
"@typescript-eslint/no-unused-vars": [
36+
"error",
37+
{
38+
"args": "after-used",
39+
"argsIgnorePattern": "^_"
40+
}
41+
],
42+
"no-use-before-define": "off",
43+
"@typescript-eslint/no-use-before-define": [
44+
"error",
45+
{
46+
"functions": false
47+
}
48+
],
49+
"no-useless-constructor": "off",
50+
"@typescript-eslint/no-useless-constructor": "error",
51+
"@typescript-eslint/no-var-requires": "off",
52+
// Other rules
53+
"class-methods-use-this": [
54+
"error",
55+
{
56+
"exceptMethods": ["dispose"]
57+
}
58+
],
59+
"func-names": "off",
60+
"import/extensions": "off",
61+
"import/namespace": "off",
62+
"import/no-extraneous-dependencies": "off",
63+
"import/no-unresolved": [
64+
"error",
65+
{
66+
"ignore": ["monaco-editor", "vscode"]
67+
}
68+
],
69+
"import/prefer-default-export": "off",
70+
"linebreak-style": "off",
71+
"no-await-in-loop": "off",
72+
"no-console": "off",
73+
"no-control-regex": "off",
74+
"no-extend-native": "off",
75+
"no-multi-str": "off",
76+
"no-param-reassign": "off",
77+
"no-prototype-builtins": "off",
78+
"no-restricted-syntax": [
79+
"error",
80+
{
81+
"selector": "ForInStatement",
82+
"message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
83+
},
84+
{
85+
"selector": "LabeledStatement",
86+
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
87+
},
88+
{
89+
"selector": "WithStatement",
90+
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
91+
}
92+
],
93+
"no-template-curly-in-string": "off",
94+
"no-underscore-dangle": "off",
95+
"no-useless-escape": "off",
96+
"no-void": [
97+
"error",
98+
{
99+
"allowAsStatement": true
100+
}
101+
],
102+
"operator-assignment": "off",
103+
"strict": "off",
104+
"prettier/prettier": ["error"]
105+
}
106+
}

.github/workflows/build.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
os: [macos-latest, ubuntu-latest, windows-latest]
20-
python-version: [3.8, 3.9]
20+
python-version: [3.9]
2121

2222
steps:
2323
- uses: actions/checkout@v2
@@ -27,14 +27,14 @@ jobs:
2727
with:
2828
python-version: ${{ matrix.python-version }}
2929

30-
- uses: Gr1N/setup-poetry@v4
31-
30+
- uses: Gr1N/setup-poetry@v4
31+
3232
- run: pip install poetry-dynamic-versioning
3333

3434
- run: poetry install
3535

3636
- run: poetry-dynamic-versioning
37-
37+
3838
- name: "test python packages"
3939
run: poetry run pytest --junitxml=test-results/python-${{ matrix.python-version }}/test-results.xml --cov=robotcode --cov-report=xml:testresults/python-${{ matrix.python-version }}/coverage.xml --cov-report=html:test-results/python-${{ matrix.python-version }}/htmlcov
4040

@@ -72,10 +72,10 @@ jobs:
7272
- name: setup python environment
7373
uses: actions/setup-python@v2
7474
with:
75-
python-version: 3.8
75+
python-version: 3.9
76+
77+
- uses: Gr1N/setup-poetry@v4
7678

77-
- uses: Gr1N/setup-poetry@v4
78-
7979
- run: pip install poetry-dynamic-versioning
8080

8181
- run: poetry install
@@ -111,14 +111,14 @@ jobs:
111111
node-version: ">=15.5"
112112
- uses: actions/setup-python@v2
113113
with:
114-
python-version: "3.8"
114+
python-version: "3.9"
115115

116116
- uses: Gr1N/setup-poetry@v4
117117

118118
- run: pip install poetry-dynamic-versioning
119119

120120
- run: poetry install
121-
121+
122122
- run: poetry-dynamic-versioning
123123

124124
- name: Build Python packages

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,5 @@ package-lock.json
276276
test-results
277277
.python-version
278278

279+
/vscode.d.ts
280+
/vscode.proposed.d.ts

.prettierignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# don't ever lint node_modules
2+
node_modules/
3+
# don't lint build output (make sure it's set to your correct build folder name)
4+
dist/
5+
out/
6+
# don't lint nyc coverage output
7+
coverage/
8+
9+
package-lock.json
10+
.vscode/
11+
vscode.d.ts
12+
vscode.proposed.d.ts
13+
14+
.mypy_cache/
15+
.pytest_cache/
16+
robotcode/
17+
18+
*.md

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"endOfLine": "auto",
5+
"quoteProps": "as-needed",
6+
"printWidth": 120
7+
}

.vscode/launch.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@
129129
"type": "extensionHost",
130130
"request": "launch",
131131
"args": [
132-
"--extensionDevelopmentPath=${workspaceFolder}"
132+
"--extensionDevelopmentPath=${workspaceFolder}",
133+
"--enable-proposed-api"
133134
],
134135
"outFiles": [
135136
"${workspaceFolder}/out/**/*.js"

language-configuration.json

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
{
2-
"comments": {
3-
// symbol used for single line comment. Remove this entry if your language does not support line comments
4-
"lineComment": "#",
5-
},
6-
// symbols used as brackets
7-
"brackets": [
8-
["{", "}"],
9-
["[", "]"],
10-
["(", ")"]
11-
],
12-
// symbols that are auto closed when typing
13-
"autoClosingPairs": [
14-
["{", "}"],
15-
["[", "]"],
16-
["(", ")"],
17-
["\"", "\""],
18-
["'", "'"]
19-
],
20-
// symbols that can be used to surround a selection
21-
"surroundingPairs": [
22-
["{", "}"],
23-
["[", "]"],
24-
["(", ")"],
25-
["\"", "\""],
26-
["'", "'"],
27-
["*", "*"],
28-
["_", "_"]
29-
]
30-
}
2+
"comments": {
3+
// symbol used for single line comment. Remove this entry if your language does not support line comments
4+
"lineComment": "#"
5+
},
6+
// symbols used as brackets
7+
"brackets": [
8+
["{", "}"],
9+
["[", "]"],
10+
["(", ")"]
11+
],
12+
// symbols that are auto closed when typing
13+
"autoClosingPairs": [
14+
["{", "}"],
15+
["[", "]"],
16+
["(", ")"],
17+
["\"", "\""],
18+
["'", "'"]
19+
],
20+
// symbols that can be used to surround a selection
21+
"surroundingPairs": [
22+
["{", "}"],
23+
["[", "]"],
24+
["(", ")"],
25+
["\"", "\""],
26+
["'", "'"],
27+
["*", "*"],
28+
["_", "_"]
29+
]
30+
}

0 commit comments

Comments
 (0)