forked from DigiLive/mushroom-strategy
Refactor ESLint rules
This commit is contained in:
@@ -35,14 +35,10 @@ export default defineConfig([
|
|||||||
},
|
},
|
||||||
|
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: {
|
globals: { ...globals.node },
|
||||||
...globals.node,
|
|
||||||
},
|
|
||||||
|
|
||||||
parser: tsParser,
|
parser: tsParser,
|
||||||
ecmaVersion: 2020,
|
ecmaVersion: 2020,
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
|
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: ['./tsconfig.json', './tsconfig.eslint.json'],
|
project: ['./tsconfig.json', './tsconfig.eslint.json'],
|
||||||
},
|
},
|
||||||
@@ -50,35 +46,13 @@ export default defineConfig([
|
|||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/no-empty-function': 'warn',
|
'@typescript-eslint/no-empty-function': 'warn',
|
||||||
|
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
||||||
'@typescript-eslint/no-unused-vars': [
|
|
||||||
'warn',
|
|
||||||
{
|
|
||||||
argsIgnorePattern: '^_',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
'comma-dangle': ['error', 'always-multiline'],
|
'comma-dangle': ['error', 'always-multiline'],
|
||||||
|
'max-len': ['warn', { code: 120, ignoreComments: true }],
|
||||||
'max-len': [
|
|
||||||
'warn',
|
|
||||||
{
|
|
||||||
code: 120,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
'no-console': 'off',
|
'no-console': 'off',
|
||||||
'no-empty-function': 'off',
|
'no-empty-function': 'off',
|
||||||
'no-unused-vars': 'off',
|
'no-unused-vars': 'off',
|
||||||
|
quotes: ['error', 'single', { avoidEscape: true }],
|
||||||
quotes: [
|
|
||||||
'error',
|
|
||||||
'single',
|
|
||||||
{
|
|
||||||
avoidEscape: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
semi: ['error', 'always'],
|
semi: ['error', 'always'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -88,7 +62,6 @@ export default defineConfig([
|
|||||||
languageOptions: {
|
languageOptions: {
|
||||||
ecmaVersion: 5,
|
ecmaVersion: 5,
|
||||||
sourceType: 'script',
|
sourceType: 'script',
|
||||||
|
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: null,
|
project: null,
|
||||||
},
|
},
|
||||||
|
927
package-lock.json
generated
927
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -165,21 +165,23 @@ export interface SingleDomainConfig extends Partial<HeaderCardConfig> {
|
|||||||
/**
|
/**
|
||||||
* Strategy Configuration.
|
* Strategy Configuration.
|
||||||
*
|
*
|
||||||
* @property {Object.<string, StrategyArea>} areas - The configuration of areas.
|
* @property {Object.<K in AreaRegistryEntry['area_id'], StrategyArea>} areas - The configuration of areas.
|
||||||
* @property {Object.<string, CustomCardConfig>} card_options - Card options for entities.
|
* @property {Object.<K in EntityRegistryEntry['entity_id'], CustomCardConfig>} card_options - Card options for entities.
|
||||||
|
* @property {Object.<K in DeviceRegistryEntry['id'], { hidden?: boolean; group_entities?: boolean }>} device_options - Device options for entities.
|
||||||
* @property {ChipConfiguration} chips - The configuration of chips in the Home view.
|
* @property {ChipConfiguration} chips - The configuration of chips in the Home view.
|
||||||
* @property {boolean} debug - If True, the strategy outputs more verbose debug information in the console.
|
* @property {boolean} debug - If True, the strategy outputs more verbose debug information in the console.
|
||||||
* @property {Object.<string, AllDomainsConfig | SingleDomainConfig>} domains - List of domains.
|
* @property {Object.<string, AllDomainsConfig | SingleDomainConfig>} domains - List of domains.
|
||||||
* @property {LovelaceCardConfig[]} extra_cards - List of cards to show below room cards.
|
* @property {LovelaceCardConfig[]} extra_cards - List of cards to show below room cards.
|
||||||
* @property {StrategyViewConfig[]} extra_views - List of custom-defined views to add to the dashboard.
|
* @property {StrategyViewConfig[]} extra_views - List of custom-defined views to add to the dashboard.
|
||||||
* @property {{ Object }} home_view - List of views to add to the dashboard.
|
* @property {{ hidden: HomeViewSections[]; stack_count: { _: number } }} home_view - List of views to add to the dashboard.
|
||||||
* @property {Record<SupportedViews, StrategyViewConfig>} views - The configurations of views.
|
* @property {Record<SupportedViews, StrategyViewConfig>} views - The configurations of views.
|
||||||
* @property {LovelaceCardConfig[]} quick_access_cards - List of custom-defined cards to show between the welcome card
|
* @property {LovelaceCardConfig[]} quick_access_cards - List of custom-defined cards to show between the welcome card and rooms cards.
|
||||||
* and rooms cards.
|
|
||||||
*/
|
*/
|
||||||
export interface StrategyConfig {
|
export interface StrategyConfig {
|
||||||
areas: { [S: string]: StrategyArea };
|
areas: { [S in AreaRegistryEntry['area_id']]: StrategyArea };
|
||||||
card_options: { [S: string]: CustomCardConfig };
|
card_options: { [S in EntityRegistryEntry['entity_id']]: CustomCardConfig };
|
||||||
|
device_options: { [S in DeviceRegistryEntry['id']]: { hidden?: boolean; group_entities?: boolean } };
|
||||||
|
// TODO: Move device entries from card_options to device_options.
|
||||||
chips: ChipConfiguration;
|
chips: ChipConfiguration;
|
||||||
debug: boolean;
|
debug: boolean;
|
||||||
domains: { [K in SupportedDomains]: K extends '_' ? AllDomainsConfig : SingleDomainConfig };
|
domains: { [K in SupportedDomains]: K extends '_' ? AllDomainsConfig : SingleDomainConfig };
|
||||||
@@ -207,8 +209,7 @@ export type StrategyDefaults = Omit<StrategyConfig, 'areas'> & {
|
|||||||
* Strategy Area.
|
* Strategy Area.
|
||||||
*
|
*
|
||||||
* @property {boolean} [hidden] True if the entity should be hidden from the dashboard.
|
* @property {boolean} [hidden] True if the entity should be hidden from the dashboard.
|
||||||
* @property {object[]} [extra_cards] - An array of card configurations.
|
* @property {object[]} [extra_cards] - Vard configurations to be added to the dashboard.
|
||||||
* The configured cards are added to the dashboard.
|
|
||||||
* @property {number} [order] - Ordering position of the area in the list of available areas.
|
* @property {number} [order] - Ordering position of the area in the list of available areas.
|
||||||
* @property {string} [type] - The type of area card.
|
* @property {string} [type] - The type of area card.
|
||||||
*/
|
*/
|
||||||
@@ -259,39 +260,6 @@ export interface CustomCardConfig extends LovelaceCardConfig {
|
|||||||
hidden?: boolean;
|
hidden?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Strategy Configuration.
|
|
||||||
*
|
|
||||||
* @property {Object.<K in keyof StrategyArea, StrategyArea>} areas - List of areas.
|
|
||||||
* @property {Object.<K in keyof RegistryEntry, CustomCardConfig>} card_options - Card options for entities.
|
|
||||||
* @property {ChipConfiguration} chips - The configuration of chips in the Home view.
|
|
||||||
* @property {boolean} debug - If True, the strategy outputs more verbose debug information in the console.
|
|
||||||
* @property {Object.<string, AllDomainsConfig | SingleDomainConfig>} domains - List of domains.
|
|
||||||
* @property {LovelaceCardConfig[]} extra_cards - List of cards to show below room cards.
|
|
||||||
* @property {StrategyViewConfig[]} extra_views - List of custom-defined views to add to the dashboard.
|
|
||||||
* @property {{ hidden: HomeViewSections[] | [] }} home_view - List of views to add to the dashboard.
|
|
||||||
* @property {Record<SupportedViews, StrategyViewConfig>} views - The configurations of views.
|
|
||||||
* @property {LovelaceCardConfig[]} quick_access_cards - List of custom-defined cards to show between the welcome card
|
|
||||||
* and rooms cards.
|
|
||||||
*/
|
|
||||||
export interface StrategyConfig {
|
|
||||||
areas: { [S in AreaRegistryEntry['area_id']]: StrategyArea };
|
|
||||||
device_options: { [S in DeviceRegistryEntry['id']]: { hidden?: boolean; group_entities?: boolean } };
|
|
||||||
// TODO: Move device entries from card_options to device_options.
|
|
||||||
card_options: { [S in EntityRegistryEntry['entity_id']]: CustomCardConfig };
|
|
||||||
chips: ChipConfiguration;
|
|
||||||
debug: boolean;
|
|
||||||
domains: { [K in SupportedDomains]: K extends '_' ? AllDomainsConfig : SingleDomainConfig };
|
|
||||||
extra_cards: LovelaceCardConfig[];
|
|
||||||
extra_views: StrategyViewConfig[];
|
|
||||||
home_view: {
|
|
||||||
hidden: HomeViewSections[];
|
|
||||||
stack_count: { _: number } & { [K in HomeViewSections]?: K extends 'areas' ? [number, number] : number };
|
|
||||||
};
|
|
||||||
views: Record<SupportedViews, StrategyViewConfig>;
|
|
||||||
quick_access_cards: LovelaceCardConfig[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base interface for sortable items.
|
* Base interface for sortable items.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user