Open History to see the last commit
1import { rules } from './rules'
2import type { ESLint, Linter } from 'eslint'
3import type { RuleModule } from '@typescript-eslint/utils/ts-eslint'
4β
5type RuleKey = keyof typeof rules
6β
7interface Plugin extends Omit<ESLint.Plugin, 'rules'> {
8 rules: Record<RuleKey, RuleModule<any, any, any>>
9 configs: {
10 recommended: ESLint.ConfigData
11 'flat/recommended': Array<Linter.FlatConfig>
12 }
13}
14β
15const plugin: Plugin = {
16 meta: {
17 name: '@tanstack/eslint-plugin-router',
18 },
19 configs: {} as Plugin['configs'],
20 rules,
21}
22β
23// Assign configs here so we can reference `plugin`
24Object.assign(plugin.configs, {
25 recommended: {
26 plugins: ['@tanstack/eslint-plugin-router'],
27 rules: {
28 '@tanstack/router/create-route-property-order': 'warn',
29 },
30 },
31 'flat/recommended': [
32 {
33 plugins: {
34 '@tanstack/router': plugin,
35 },
36 rules: {
37 '@tanstack/router/create-route-property-order': 'warn',
38 },
39 },
40 ],
41})
42β
43export default plugin