Skip to content

Commit

Permalink
feat: support eslint-define-config rules (#14)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
Shinigami92 and antfu committed Oct 9, 2023
1 parent ecca1b7 commit 9d5ef1f
Show file tree
Hide file tree
Showing 96 changed files with 2,468 additions and 15 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@
"@stylistic/eslint-plugin-ts": "workspace:*",
"@types/eslint": "^8.44.3",
"@types/fs-extra": "^11.0.2",
"@types/json-schema": "^7.0.13",
"@types/node": "^20.7.2",
"bumpp": "^9.2.0",
"change-case": "^5.0.2",
"eslint": "^8.50.0",
"esno": "^0.17.0",
"fast-glob": "^3.3.1",
"fs-extra": "^11.1.1",
"json-schema": "^0.4.0",
"json-schema-to-typescript": "^13.1.1",
"lint-staged": "^14.0.1",
"pnpm": "^8.8.0",
"rimraf": "^5.0.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type Schema0 =
| ('always' | 'never' | 'consistent')
| {
multiline?: boolean
minItems?: number | null
}

export type RuleOptions = [Schema0?]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export type Schema0 = 'always' | 'never'

export interface Schema1 {
singleValue?: boolean
objectsInArrays?: boolean
arraysInArrays?: boolean
}

export type RuleOptions = [Schema0?, Schema1?]
17 changes: 17 additions & 0 deletions packages/eslint-plugin-js/rules/array-element-newline/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export type Schema0 =
| []
| [
| BasicConfig
| {
ArrayExpression?: BasicConfig
ArrayPattern?: BasicConfig
},
]
export type BasicConfig =
| ('always' | 'never' | 'consistent')
| {
multiline?: boolean
minItems?: number | null
}

export type RuleOptions = [Schema0?]
6 changes: 6 additions & 0 deletions packages/eslint-plugin-js/rules/arrow-spacing/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface Schema0 {
before?: boolean
after?: boolean
}

export type RuleOptions = [Schema0?]
3 changes: 3 additions & 0 deletions packages/eslint-plugin-js/rules/block-spacing/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type Schema0 = 'always' | 'never'

export type RuleOptions = [Schema0?]
7 changes: 7 additions & 0 deletions packages/eslint-plugin-js/rules/brace-style/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type Schema0 = '1tbs' | 'stroustrup' | 'allman'

export interface Schema1 {
allowSingleLine?: boolean
}

export type RuleOptions = [Schema0?, Schema1?]
16 changes: 16 additions & 0 deletions packages/eslint-plugin-js/rules/comma-dangle/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export type Schema0 =
| []
| [
| Value
| {
arrays?: ValueWithIgnore
objects?: ValueWithIgnore
imports?: ValueWithIgnore
exports?: ValueWithIgnore
functions?: ValueWithIgnore
},
]
export type Value = 'always-multiline' | 'always' | 'never' | 'only-multiline'
export type ValueWithIgnore = 'always-multiline' | 'always' | 'ignore' | 'never' | 'only-multiline'

export type RuleOptions = [Schema0?]
6 changes: 6 additions & 0 deletions packages/eslint-plugin-js/rules/comma-spacing/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface Schema0 {
before?: boolean
after?: boolean
}

export type RuleOptions = [Schema0?]
9 changes: 9 additions & 0 deletions packages/eslint-plugin-js/rules/comma-style/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export type Schema0 = 'first' | 'last'

export interface Schema1 {
exceptions?: {
[k: string]: boolean
}
}

export type RuleOptions = [Schema0?, Schema1?]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type Schema0 = 'always' | 'never'

export interface Schema1 {
enforceForClassMembers?: boolean
}

export type RuleOptions = [Schema0?, Schema1?]
3 changes: 3 additions & 0 deletions packages/eslint-plugin-js/rules/dot-location/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type Schema0 = 'object' | 'property'

export type RuleOptions = [Schema0?]
3 changes: 3 additions & 0 deletions packages/eslint-plugin-js/rules/eol-last/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type Schema0 = 'always' | 'never' | 'unix' | 'windows'

export type RuleOptions = [Schema0?]
13 changes: 13 additions & 0 deletions packages/eslint-plugin-js/rules/func-call-spacing/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export type Schema0 =
| []
| ['never']
| []
| ['always']
| [
'always',
{
allowNewlines?: boolean
},
]

export type RuleOptions = [Schema0?]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type Schema0 = 'always' | 'never' | 'consistent'

export type RuleOptions = [Schema0?]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type Schema0 =
| ('always' | 'never' | 'consistent' | 'multiline' | 'multiline-arguments')
| {
minItems?: number
}

export type RuleOptions = [Schema0?]
26 changes: 26 additions & 0 deletions packages/eslint-plugin-js/rules/generator-star-spacing/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export type Schema0 =
| ('before' | 'after' | 'both' | 'neither')
| {
before?: boolean
after?: boolean
named?:
| ('before' | 'after' | 'both' | 'neither')
| {
before?: boolean
after?: boolean
}
anonymous?:
| ('before' | 'after' | 'both' | 'neither')
| {
before?: boolean
after?: boolean
}
method?:
| ('before' | 'after' | 'both' | 'neither')
| {
before?: boolean
after?: boolean
}
}

export type RuleOptions = [Schema0?]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type Schema0 = 'beside' | 'below'

export type RuleOptions = [Schema0?]
37 changes: 37 additions & 0 deletions packages/eslint-plugin-js/rules/indent/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export type Schema0 = 'tab' | number

export interface Schema1 {
SwitchCase?: number
VariableDeclarator?:
| (number | ('first' | 'off'))
| {
var?: number | ('first' | 'off')
let?: number | ('first' | 'off')
const?: number | ('first' | 'off')
}
outerIIFEBody?: number | 'off'
MemberExpression?: number | 'off'
FunctionDeclaration?: {
parameters?: number | ('first' | 'off')
body?: number
}
FunctionExpression?: {
parameters?: number | ('first' | 'off')
body?: number
}
StaticBlock?: {
body?: number
}
CallExpression?: {
arguments?: number | ('first' | 'off')
}
ArrayExpression?: number | ('first' | 'off')
ObjectExpression?: number | ('first' | 'off')
ImportDeclaration?: number | ('first' | 'off')
flatTernaryExpressions?: boolean
offsetTernaryExpressions?: boolean
ignoredNodes?: string[]
ignoreComments?: boolean
}

export type RuleOptions = [Schema0?, Schema1?]
3 changes: 3 additions & 0 deletions packages/eslint-plugin-js/rules/jsx-quotes/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type Schema0 = 'prefer-single' | 'prefer-double'

export type RuleOptions = [Schema0?]
54 changes: 54 additions & 0 deletions packages/eslint-plugin-js/rules/key-spacing/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
export type Schema0 =
| {
align?:
| ('colon' | 'value')
| {
mode?: 'strict' | 'minimum'
on?: 'colon' | 'value'
beforeColon?: boolean
afterColon?: boolean
}
mode?: 'strict' | 'minimum'
beforeColon?: boolean
afterColon?: boolean
}
| {
singleLine?: {
mode?: 'strict' | 'minimum'
beforeColon?: boolean
afterColon?: boolean
}
multiLine?: {
align?:
| ('colon' | 'value')
| {
mode?: 'strict' | 'minimum'
on?: 'colon' | 'value'
beforeColon?: boolean
afterColon?: boolean
}
mode?: 'strict' | 'minimum'
beforeColon?: boolean
afterColon?: boolean
}
}
| {
singleLine?: {
mode?: 'strict' | 'minimum'
beforeColon?: boolean
afterColon?: boolean
}
multiLine?: {
mode?: 'strict' | 'minimum'
beforeColon?: boolean
afterColon?: boolean
}
align?: {
mode?: 'strict' | 'minimum'
on?: 'colon' | 'value'
beforeColon?: boolean
afterColon?: boolean
}
}

export type RuleOptions = [Schema0?]

0 comments on commit 9d5ef1f

Please sign in to comment.