Skip to content

Commit

Permalink
feat: add flat/all config
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j committed Mar 19, 2024
1 parent ce776bf commit 010412c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 8 deletions.
15 changes: 10 additions & 5 deletions src/configs/all.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
const config = {
plugins: ['lit'],
import type {ESLint, Linter} from 'eslint';

export const configFactory = (plugin: ESLint.Plugin): Linter.FlatConfig => ({
plugins: {
lit: plugin
},

rules: {
'lit/attribute-names': 'error',
'lit/attribute-value-entities': 'error',
'lit/ban-attributes': 'error',
'lit/binding-positions': 'error',
'lit/lifecycle-super': 'error',
'lit/no-classfield-shadowing': 'error',
'lit/no-duplicate-template-bindings': 'error',
'lit/no-invalid-escape-sequences': 'error',
'lit/no-invalid-html': 'error',
Expand All @@ -24,6 +31,4 @@ const config = {
'lit/quoted-expressions': 'error',
'lit/value-after-constraints': 'error'
}
};

export default config;
});
32 changes: 32 additions & 0 deletions src/configs/legacy-all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type {ESLint} from 'eslint';

export const config: ESLint.ConfigData = {
plugins: ['lit'],

rules: {
'lit/attribute-names': 'error',
'lit/attribute-value-entities': 'error',
'lit/ban-attributes': 'error',
'lit/binding-positions': 'error',
'lit/lifecycle-super': 'error',
'lit/no-classfield-shadowing': 'error',
'lit/no-duplicate-template-bindings': 'error',
'lit/no-invalid-escape-sequences': 'error',
'lit/no-invalid-html': 'error',
'lit/no-legacy-imports': 'error',
'lit/no-legacy-template-syntax': 'error',
'lit/no-native-attributes': 'error',
'lit/no-private-properties': 'error',
'lit/no-property-change-update': 'error',
'lit/no-template-arrow': 'error',
'lit/no-template-bind': 'error',
'lit/no-template-map': 'error',
'lit/no-this-assign-in-render': 'error',
'lit/no-useless-template-literals': 'error',
'lit/no-value-attribute': 'error',
'lit/prefer-nothing': 'error',
'lit/prefer-static-styles': 'error',
'lit/quoted-expressions': 'error',
'lit/value-after-constraints': 'error'
}
};
4 changes: 3 additions & 1 deletion src/configs/legacy-recommended.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const config = {
import type {ESLint} from 'eslint';

export const config: ESLint.ConfigData = {
plugins: ['lit'],

rules: {
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {Rule, ESLint} from 'eslint';
import all from './configs/all';
import {configFactory as configAll} from './configs/all';
import {config as configLegacyAll} from './configs/legacy-all';
import {config as configLegacyRecommended} from './configs/legacy-recommended';
import {configFactory as configRecommended} from './configs/recommended';
import requireIndex = require('requireindex');
Expand All @@ -12,7 +13,8 @@ export const rules = requireIndex(`${__dirname}/rules`) as Record<
const plugin: ESLint.Plugin = {rules};

export const configs = {
all,
all: configLegacyAll,
'flat/all': configAll(plugin),
recommended: configLegacyRecommended,
'flat/recommended': configRecommended(plugin)
};

0 comments on commit 010412c

Please sign in to comment.