Skip to content

Commit

Permalink
improve eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Zalmanski committed Apr 22, 2024
1 parent 654909f commit abe13e0
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
6 changes: 3 additions & 3 deletions drivers/nuos/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,13 +436,13 @@ class NuosDevice extends Device {
async #plantSettings(postSettings: PostSettings): Promise<boolean> {
if (Object.keys(postSettings).length) {
try {
const { success } = (
const { success: isSuccess } = (
await this.#aristonAPI.plantSettings(this.#id, postSettings)
).data
if (success) {
if (isSuccess) {
await this.#setSettingCapabilities(postSettings)
}
return success
return isSuccess
} catch (error) {
// Error handling is delegated to the interceptor
}
Expand Down
53 changes: 52 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,58 @@ module.exports = tsEslint.config(
},
},
],
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/naming-convention': [
'error',
{
filter: {
match: true,
regex: '^[a-z]+(?:_[a-z0-9]+)*\\.[a-z]+(?:_[a-z0-9]+)*$',
},
format: null,
selector: [
'objectLiteralMethod',
'objectLiteralProperty',
'typeProperty',
],
},
{
format: ['camelCase', 'snake_case'],
selector: 'objectLiteralProperty',
},
{
format: ['camelCase', 'PascalCase', 'snake_case'],
selector: 'typeProperty',
},
{
format: ['camelCase', 'PascalCase'],
selector: 'import',
},
{
format: ['PascalCase'],
prefix: ['can', 'did', 'has', 'is', 'should', 'will'],
selector: 'variable',
types: ['boolean'],
},
{
format: ['camelCase'],
modifiers: ['global'],
selector: 'variable',
types: ['function'],
},
{
format: ['camelCase', 'UPPER_CASE'],
modifiers: ['global'],
selector: 'variable',
},
{
format: ['PascalCase'],
selector: 'typeLike',
},
{
format: ['camelCase'],
selector: 'default',
},
],
'@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true }],
'@typescript-eslint/no-magic-numbers': ['error', { ignoreEnums: true }],
'@typescript-eslint/no-unused-vars': [
Expand Down

0 comments on commit abe13e0

Please sign in to comment.