Skip to content

Commit

Permalink
introduce ESLint and Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
d-biehl committed Jul 12, 2021
1 parent c511a6e commit d032d31
Show file tree
Hide file tree
Showing 22 changed files with 2,606 additions and 2,510 deletions.
10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules/
dist/
out/
coverage/

vscode.d.ts
vscode.proposed.d.ts

.mypy_cache/
.pytest_cache/
106 changes: 106 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"env": {
"node": true,
"es6": true,
"mocha": true
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier"],
"extends": [
"standard",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"prettier"
],
"rules": {
// Overriding ESLint rules with Typescript-specific ones
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": "allow-with-description"
}
],
"@typescript-eslint/explicit-module-boundary-types": "error",
"no-bitwise": "off",
"no-dupe-class-members": "off",
"@typescript-eslint/no-dupe-class-members": "error",
"no-empty-function": "off",
"@typescript-eslint/no-empty-function": ["error"],
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-non-null-assertion": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": [
"error",
{
"functions": false
}
],
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "off",
// Other rules
"class-methods-use-this": [
"error",
{
"exceptMethods": ["dispose"]
}
],
"func-names": "off",
"import/extensions": "off",
"import/namespace": "off",
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": [
"error",
{
"ignore": ["monaco-editor", "vscode"]
}
],
"import/prefer-default-export": "off",
"linebreak-style": "off",
"no-await-in-loop": "off",
"no-console": "off",
"no-control-regex": "off",
"no-extend-native": "off",
"no-multi-str": "off",
"no-param-reassign": "off",
"no-prototype-builtins": "off",
"no-restricted-syntax": [
"error",
{
"selector": "ForInStatement",
"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."
},
{
"selector": "LabeledStatement",
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
},
{
"selector": "WithStatement",
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
}
],
"no-template-curly-in-string": "off",
"no-underscore-dangle": "off",
"no-useless-escape": "off",
"no-void": [
"error",
{
"allowAsStatement": true
}
],
"operator-assignment": "off",
"strict": "off",
"prettier/prettier": ["error"]
}
}
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: [3.8, 3.9]
python-version: [3.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -27,14 +27,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

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

- run: pip install poetry-dynamic-versioning

- run: poetry install

- run: poetry-dynamic-versioning

- name: "test python packages"
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

Expand Down Expand Up @@ -72,10 +72,10 @@ jobs:
- name: setup python environment
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9

- uses: Gr1N/setup-poetry@v4

- uses: Gr1N/setup-poetry@v4

- run: pip install poetry-dynamic-versioning

- run: poetry install
Expand Down Expand Up @@ -111,14 +111,14 @@ jobs:
node-version: ">=15.5"
- uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.9"

- uses: Gr1N/setup-poetry@v4

- run: pip install poetry-dynamic-versioning

- run: poetry install

- run: poetry-dynamic-versioning

- name: Build Python packages
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,5 @@ package-lock.json
test-results
.python-version

/vscode.d.ts
/vscode.proposed.d.ts
18 changes: 18 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# don't ever lint node_modules
node_modules/
# don't lint build output (make sure it's set to your correct build folder name)
dist/
out/
# don't lint nyc coverage output
coverage/

package-lock.json
.vscode/
vscode.d.ts
vscode.proposed.d.ts

.mypy_cache/
.pytest_cache/
robotcode/

*.md
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 2,
"useTabs": false,
"endOfLine": "auto",
"quoteProps": "as-needed",
"printWidth": 120
}
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
"--extensionDevelopmentPath=${workspaceFolder}",
"--enable-proposed-api"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
Expand Down
58 changes: 29 additions & 29 deletions language-configuration.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "#",
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["*", "*"],
["_", "_"]
]
}
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "#"
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["*", "*"],
["_", "_"]
]
}
Loading

0 comments on commit d032d31

Please sign in to comment.