Skip to content

Commit 3b7722b

Browse files
committed
chore: use workspace packages in tsslint.config.ts
1 parent 89dbc73 commit 3b7722b

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"devDependencies": {
1919
"@lerna-lite/cli": "latest",
2020
"@lerna-lite/publish": "latest",
21-
"@tsslint/config": "3.0.2",
2221
"@types/node": "latest",
2322
"@typescript-eslint/eslint-plugin": "latest",
2423
"dprint": "latest",

packages/config/lib/eslint.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ const loader = async (moduleName: string) => {
4141
export async function importESLintRules(
4242
config: { [K in keyof ESLintRulesConfig]: RuleSeverity | [RuleSeverity, ...ESLintRulesConfig[K]] },
4343
context: Partial<ESLint.Rule.RuleContext> = {},
44+
getConvertRule = async () => {
45+
try {
46+
return (await import('@tsslint/compat-eslint')).convertRule;
47+
}
48+
catch {
49+
throw new Error('Please install @tsslint/compat-eslint to use importESLintRules().');
50+
}
51+
},
4452
) {
45-
let convertRule: typeof import('@tsslint/compat-eslint').convertRule;
46-
try {
47-
({ convertRule } = await import('@tsslint/compat-eslint'));
48-
}
49-
catch {
50-
throw new Error('Please install @tsslint/compat-eslint to use importESLintRules().');
51-
}
52-
53+
const convertRule = await getConvertRule();
5354
const rules: TSSLint.Rules = {};
5455
for (const [rule, severityOrOptions] of Object.entries(config)) {
5556
let severity: RuleSeverity;

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsslint.config.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
import { defineConfig, importESLintRules } from '@tsslint/config';
1+
import { defineConfig, importESLintRules } from './packages/config/index.js';
22

33
export default defineConfig({
4-
rules: await importESLintRules({
5-
'@typescript-eslint/consistent-type-imports': [true, {
6-
disallowTypeAnnotations: false,
7-
fixStyle: 'inline-type-imports',
8-
}],
9-
'@typescript-eslint/no-unnecessary-type-assertion': true,
10-
}),
4+
rules: await importESLintRules(
5+
{
6+
'@typescript-eslint/consistent-type-imports': [true, {
7+
disallowTypeAnnotations: false,
8+
fixStyle: 'inline-type-imports',
9+
}],
10+
'@typescript-eslint/no-unnecessary-type-assertion': true,
11+
},
12+
{},
13+
async () => (await import('./packages/compat-eslint/index.js')).convertRule,
14+
),
1115
});

0 commit comments

Comments
 (0)