Skip to content

Commit

Permalink
feat: add typescript types
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io authored Jul 16, 2024
1 parent e6d16f5 commit 1b29cdb
Show file tree
Hide file tree
Showing 4 changed files with 450 additions and 5 deletions.
8 changes: 5 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { Linter, ESLint } from 'eslint'

import sortIntersectionTypes, { RULE_NAME as sortIntersectionTypesName } from './rules/sort-intersection-types'
import sortSvelteAttributes, { RULE_NAME as sortSvelteAttributesName } from './rules/sort-svelte-attributes'
import sortAstroAttributes, { RULE_NAME as sortAstroAttributesName } from './rules/sort-astro-attributes'
Expand Down Expand Up @@ -48,7 +50,7 @@ let plugin = {
[sortMapsName]: sortMaps,
},
name: 'perfectionist',
}
} as unknown as ESLint.Plugin

let getRules = (
options: BaseOptions,
Expand Down Expand Up @@ -131,14 +133,14 @@ let getRules = (
)
}

let createConfig = (options: BaseOptions) => ({
let createConfig = (options: BaseOptions): Linter.FlatConfig => ({
plugins: {
perfectionist: plugin,
},
rules: getRules(options),
})

let createLegacyConfig = (options: BaseOptions) => ({
let createLegacyConfig = (options: BaseOptions): Linter.Config => ({
plugins: ['perfectionist'],
rules: getRules(options),
})
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@
"./dist"
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs"
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./package.json": "./package.json"
},
Expand Down Expand Up @@ -86,6 +89,7 @@
"@nanostores/vue": "^0.10.0",
"@playform/compress": "^0.0.13",
"@poppanator/sveltekit-svg": "5.0.0-svelte5.3",
"@types/eslint": "^8.56.10",
"@types/mdast": "^4.0.4",
"@types/natural-compare-lite": "^1.4.2",
"@types/node": "^20.14.10",
Expand Down Expand Up @@ -144,6 +148,7 @@
"unified": "^11.0.5",
"unist-util-visit": "^5.0.0",
"vite": "^5.3.3",
"vite-plugin-dts": "^3.9.1",
"vite-plugin-lightningcss": "^0.0.5",
"vitest": "^2.0.2"
}
Expand Down
Loading

0 comments on commit 1b29cdb

Please sign in to comment.