Skip to content

Commit

Permalink
fix: Implement prettier (#7702)
Browse files Browse the repository at this point in the history
* fix: Implement prettier

* Automatic changes: npm run eslint -- --fix

* Update pretty directory

* Automatic changes: npm run pretty:write

* fix build

* fix errors

* Updates
  • Loading branch information
Koenkk authored Jun 29, 2024
1 parent caf39c1 commit 607a13e
Show file tree
Hide file tree
Showing 359 changed files with 34,719 additions and 21,895 deletions.
46 changes: 41 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,63 @@
"es6": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "google"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"eslint-plugin-tsdoc"
"eslint-plugin-tsdoc",
"perfectionist"
],
"root": true,
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"require-jsdoc": "off",
"indent": ["error", 4],
"no-prototype-builtins": "off",
"max-len": ["error", { "code": 150 }],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-floating-promises": "error",
"tsdoc/syntax": "warn",
"valid-jsdoc": "off"
"valid-jsdoc": "off",
"perfectionist/sort-imports": [
"error",
{
"groups": [
"type",
[
"builtin",
"external"
],
"internal-type",
"internal",
[
"parent-type",
"sibling-type",
"index-type"
],
[
"parent",
"sibling",
"index"
],
"object",
"unknown"
],
"custom-groups": {
"value": {},
"type": {}
},
"newlines-between": "always",
"internal-pattern": [
"~/**"
],
"type": "natural",
"order": "asc",
"ignore-case": false
}
]
},
"overrides": [
{
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ jobs:
run: npm ci
- name: Build
run: npm run build
- name: Lint
run: |
npm run pretty:check
npm run eslint
- name: Test
run: npm test
- name: Lint
run: npm run lint
- name: Publish new release
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
run: |
Expand Down
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 150,
"bracketSpacing": false,
"endOfLine": "lf",
"tabWidth": 4
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ See [Zigbee2MQTT how to support new devices](https://www.zigbee2mqtt.io/advanced
If you'd like to submit a pull request, you should run the following commands to ensure your changes will pass the tests:
```sh
npm install
npm run lint
npm run eslint -- --fix
npm run pretty:write
npm run build
npm test
```
Expand Down
71 changes: 63 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"zigbee-shepherd"
],
"scripts": {
"lint": "eslint .",
"eslint": "eslint src/ --max-warnings=0",
"pretty:write": "prettier --write src test",
"pretty:check": "prettier --check src test",
"test": "ZHC_TEST=true jest test --silent --maxWorkers=50%",
"test-watch": "ZHC_TEST=true jest test --silent --watch --maxWorkers=25%",
"clean": "rimraf --glob index* devices lib converters tsconfig.tsbuildinfo",
Expand Down Expand Up @@ -59,11 +61,13 @@
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"eslint": "^8.57.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-perfectionist": "^2.11.0",
"eslint-plugin-tsdoc": "^0.3.0",
"fast-deep-equal": "*",
"jest": "^29.7.0",
"prettier": "^3.3.2",
"rimraf": "^5.0.7",
"ts-jest": "^29.1.5",
"ts-morph": "^22.0.0",
Expand Down
Loading

0 comments on commit 607a13e

Please sign in to comment.