Skip to content

Commit

Permalink
feat: Add TypeScript support to ESLint configuration and refactor rel…
Browse files Browse the repository at this point in the history
…ated types
  • Loading branch information
Simoon-F committed Jan 13, 2025
1 parent 132d202 commit 7a80f89
Show file tree
Hide file tree
Showing 11 changed files with 343 additions and 31 deletions.
4 changes: 3 additions & 1 deletion eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { avenger } from './src';

export default avenger();
export default avenger({
typescript: true,
});
Empty file added example/react.tsx
Empty file.
5 changes: 3 additions & 2 deletions generate-eslint-type/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'node:fs/promises'
import { mergeFlatConfigs } from '../src'
import { mergeFlatConfigs, typescript } from '../src'
import { builtinRules } from 'eslint/use-at-your-own-risk'
import { flatConfigsToRulesDTS } from 'eslint-typegen/core'
import { javascript } from 'src/configs/javascript'
Expand All @@ -12,7 +12,8 @@ const configs = await mergeFlatConfigs(
}
}
},
javascript()
javascript(),
typescript()
)

const configNames = configs.map(i => i.name).filter(Boolean) as string[]
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"license": "MIT",
"type": "module",
"devDependencies": {
"@sj-distributor/eslint-config": "workspace:*",
"@types/node": "^22.10.5",
"eslint": "^9.17.0",
"eslint-plugin-unused-imports": "^4.1.4",
Expand All @@ -37,8 +38,7 @@
"jiti": "^2.4.2",
"tsup": "^8.3.5",
"tsx": "^4.19.2",
"typescript": "^5.7.3",
"@sj-distributor/eslint-config": "workspace:*"
"typescript": "^5.7.3"
},
"peerDependencies": {
"eslint": "^9.17.0"
Expand All @@ -47,7 +47,8 @@
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"eslint-flat-config-utils": "^0.4.0",
"globals": "^15.14.0"
"globals": "^15.14.0",
"local-pkg": "^1.0.0"
},
"resolutions": {
"tsx": "^4.19.2",
Expand Down
46 changes: 46 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/configs/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './javascript'
export * from './javascript'
export * from './typescript'
4 changes: 2 additions & 2 deletions src/configs/javascript.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import globals from 'globals';
import type { OptionsOverrides, EslintFlatConfigItem } from 'src/types';
import type { IOptionsOverrides, EslintFlatConfigItem } from 'src/types';
import { default as unusedImportsPlugin } from 'eslint-plugin-unused-imports'

export const javascript = async (
{ overrides }: OptionsOverrides = {}
{ overrides = {} }: IOptionsOverrides = {}
): Promise<EslintFlatConfigItem[]> => {
return [
{
Expand Down
Loading

0 comments on commit 7a80f89

Please sign in to comment.