Skip to content

Commit

Permalink
update eslint dependencies and lint whole project
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Aug 10, 2024
1 parent 94783a5 commit 4602e77
Show file tree
Hide file tree
Showing 18 changed files with 415 additions and 530 deletions.
38 changes: 0 additions & 38 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# contact_links:
# - name: Homebridge Discord Community
# url: https://discord.gg/kqNCe2D
# about: Ask your questions in the #YOUR_CHANNEL_HERE channel
# about: Ask your questions in the #YOUR_CHANNEL_HERE channel
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ assignees: ''
**Additional context:**
<!-- Add any other context or screenshots about the feature request here. -->


<!-- Click the "Preview" tab before you submit to ensure the formatting is correct. -->
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ jobs:
strategy:
fail-fast: false
matrix:
# the Node.js versions to build on
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ src
.github

# eslint
.eslintrc
eslint.config.js

# typescript
tsconfig.json
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.rulers": [ 140 ],
"editor.rulers": [140],
"eslint.enable": true
}
}
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

</span>

> [!IMPORTANT]
> [!IMPORTANT]
> **Homebridge v2.0 Information**
>
>
> This template currently has a
> - `package.json -> engines.homebridge` value of `"^1.8.0 || ^2.0.0-beta.0"`
> - `package.json -> devDependencies.homebridge` value of `"^2.0.0-beta.0"`
>
> This is to ensure that your plugin will build and run on both Homebridge v1 and v2.
>
>
> Once Homebridge v2.0 has been released, you can remove the `-beta.0` in both places.
> [!IMPORTANT]
> [!IMPORTANT]
> **Node v22 Information**
>
> This template currently has a
Expand Down Expand Up @@ -65,8 +65,9 @@ Open the [`package.json`](./package.json) and change the following attributes:

- `name` - this should be prefixed with `homebridge-` or `@username/homebridge-`, is case-sensitive, and contains no spaces nor special characters apart from a dash `-`
- `displayName` - this is the "nice" name displayed in the Homebridge UI
- `repository.url` - Link to your GitHub repo
- `bugs.url` - Link to your GitHub repo issues page
- `homepage` - link to your GitHub repo's `README.md`
- `repository.url` - link to your GitHub repo
- `bugs.url` - link to your GitHub repo issues page

When you are ready to publish the plugin you should set `private` to false, or remove the attribute entirely.

Expand All @@ -75,7 +76,7 @@ When you are ready to publish the plugin you should set `private` to false, or r
Open the [`src/settings.ts`](./src/settings.ts) file and change the default values:

- `PLATFORM_NAME` - Set this to be the name of your platform. This is the name of the platform that users will use to register the plugin in the Homebridge `config.json`.
- `PLUGIN_NAME` - Set this to be the same name you set in the [`package.json`](./package.json) file.
- `PLUGIN_NAME` - Set this to be the same name you set in the [`package.json`](./package.json) file.

Open the [`config.schema.json`](./config.schema.json) file and change the following attribute:

Expand Down Expand Up @@ -190,6 +191,7 @@ sudo npm install -g homebridge-example-plugin@beta
```

### Best Practices

Consider creating your plugin with the [Homebridge Verified](https://github.com/homebridge/verified) criteria in mind. This will help you to create a plugin that is easy to use and works well with Homebridge.
You can then submit your plugin to the Homebridge Verified list for review.
The most up-to-date criteria can be found [here](https://github.com/homebridge/verified#requirements).
Expand All @@ -208,5 +210,7 @@ For reference, the current criteria are:
- If the plugin needs to write files to disk (cache, keys, etc.), it must store them inside the Homebridge storage directory.

### Useful Links

Note these links are here for help but are not supported/verified by the Homebridge team

- [Custom Characteristics](https://github.com/homebridge/homebridge-plugin-template/issues/20)
2 changes: 1 addition & 1 deletion config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
}
}
}
}
}
35 changes: 35 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{
ignores: ['dist/**'],
},
{
rules: {
'quotes': ['error', 'single'],
'indent': ['error', 2, { 'SwitchCase': 0 }],
'linebreak-style': ['error', 'unix'],
'semi': ['error', 'always'],
'comma-dangle': ['error', 'always-multiline'],
'dot-notation': 'error',
'eqeqeq': ['error', 'smart'],
'curly': ['error', 'all'],
'brace-style': ['error'],
'prefer-arrow-callback': 'warn',
'max-len': ['warn', 160],
'object-curly-spacing': ['error', 'always'],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error', { 'classes': false, 'enums': false }],
'@typescript-eslint/no-unused-vars': ['error', { 'caughtErrors': 'none' }],
},
},
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
);
2 changes: 1 addition & 1 deletion nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"env": {
"NODE_OPTIONS": "--trace-warnings"
}
}
}
Loading

0 comments on commit 4602e77

Please sign in to comment.