Skip to content

Commit

Permalink
fix: stylistic overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 21, 2023
1 parent 70fc8b6 commit 6074698
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -36,7 +36,7 @@
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"eslint-define-config": "^1.23.0",
"eslint-plugin-antfu": "^1.0.0-beta.1",
"eslint-plugin-antfu": "^1.0.0-beta.2",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-i": "^2.28.1",
"eslint-plugin-jsdoc": "^46.8.2",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion src/configs/markdown.ts
Expand Up @@ -46,7 +46,7 @@ export function markdown(options: OptionsComponentExts = {}): FlatESLintConfigIt
'no-undef': OFF,
'no-unused-expressions': OFF,
'no-unused-vars': OFF,

'node/prefer-global/process': OFF,

'ts/comma-dangle': OFF,
Expand Down
3 changes: 1 addition & 2 deletions src/configs/stylistic.ts
Expand Up @@ -4,7 +4,6 @@ import { pluginStylisticJs, pluginStylisticTs, pluginTs } from '../plugins'
import { OFF } from '../flags'

const tsPackage = packages.find(i => i.shortId === 'ts')!
const jsPackage = packages.find(i => i.shortId === 'js')!

export const javascriptStylistic: FlatESLintConfigItem[] = [
{
Expand Down Expand Up @@ -139,7 +138,7 @@ function stylisticJsToTS(input: Record<string, any>) {
if (!key.startsWith('style/'))
return null!
const basename = key.replace('style/', '')
if (jsPackage.rules.find(i => i.name === basename))
if (tsPackage.rules.find(i => i.name === basename))
return [key, OFF]
return null!
})
Expand Down
2 changes: 1 addition & 1 deletion src/configs/typescript.ts
Expand Up @@ -54,7 +54,7 @@ export function typescript(options?: OptionsComponentExts): FlatESLintConfigItem
'no-redeclare': OFF,
'no-use-before-define': OFF,
'no-useless-constructor': OFF,

// TS
'ts/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
'ts/ban-ts-ignore': OFF,
Expand Down
8 changes: 4 additions & 4 deletions src/factory.ts
Expand Up @@ -68,9 +68,9 @@ export function antfu(options: OptionsConfig = {}, ...userConfigs: (FlatESLintCo
if (options.test ?? true)
configs.push(test({ isInEditor }))

if (enableVue)
configs.push(vue({ typescript: !!enableTypeScript }))
if (enableVue)
configs.push(vue({ typescript: !!enableTypeScript }))

if (options.jsonc ?? true) {
configs.push(
jsonc,
Expand All @@ -82,7 +82,7 @@ export function antfu(options: OptionsConfig = {}, ...userConfigs: (FlatESLintCo
if (options.yaml ?? true)
configs.push(yml)

if (options.markdown ?? true)
if (options.markdown ?? true)
configs.push(markdown({ componentExts }))

return combine(
Expand Down
1 change: 0 additions & 1 deletion src/plugins.ts
Expand Up @@ -21,4 +21,3 @@ export { default as parserTs } from '@typescript-eslint/parser'
export { default as parserVue } from 'vue-eslint-parser'
export { default as parserYml } from 'yaml-eslint-parser'
export { default as parserJsonc } from 'jsonc-eslint-parser'

2 changes: 0 additions & 2 deletions src/types.ts
Expand Up @@ -73,10 +73,8 @@ export interface OptionsConfig {
*/
stylistic?: boolean


/**
* Control to disable some rules in editors.
*
* @default auto-detect based on the process.env
*/
isInEditor?: boolean
Expand Down

0 comments on commit 6074698

Please sign in to comment.