A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/antfu/eslint-config/commit/f31a824 below:

rename plugin prefixes for consistency · antfu/eslint-config@f31a824 · GitHub

1 1

import type { FlatESLintConfigItem } from 'eslint-define-config'

2 -

import { rules } from '@eslint-stylistic/metadata'

3 -

import { pluginStylisticJs, pluginStylisticTs } from '../plugins'

2 +

import { packages } from '@eslint-stylistic/metadata'

3 +

import { pluginStylisticJs, pluginStylisticTs, pluginTs } from '../plugins'

4 4

import { OFF } from '../flags'

5 5 6 +

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

7 +

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

8 + 6 9

export const javascriptStylistic: FlatESLintConfigItem[] = [

7 10

{

8 11

plugins: {

9 -

'@stylistic/js': pluginStylisticJs,

12 +

style: pluginStylisticJs,

10 13

},

11 14

rules: {

12 -

'@stylistic/js/array-bracket-spacing': ['error', 'never'],

13 -

'@stylistic/js/arrow-spacing': ['error', { after: true, before: true }],

14 -

'@stylistic/js/block-spacing': ['error', 'always'],

15 -

'@stylistic/js/brace-style': ['error', 'stroustrup', { allowSingleLine: true }],

16 -

'@stylistic/js/comma-spacing': ['error', { after: true, before: false }],

17 -

'@stylistic/js/comma-style': ['error', 'last'],

18 -

'@stylistic/js/computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],

19 -

'@stylistic/js/dot-location': ['error', 'property'],

20 -

'@stylistic/js/func-call-spacing': OFF,

21 -

'@stylistic/js/generator-star-spacing': OFF,

22 -

'@stylistic/js/indent': ['error', 2, {

15 +

'antfu/if-newline': 'error',

16 +

'comma-dangle': ['error', 'always-multiline'],

17 +

'curly': ['error', 'multi-or-nest', 'consistent'],

18 +

'quotes': ['error', 'single'],

19 +

'semi': ['error', 'never'],

20 + 21 +

'style/array-bracket-spacing': ['error', 'never'],

22 +

'style/arrow-spacing': ['error', { after: true, before: true }],

23 +

'style/block-spacing': ['error', 'always'],

24 +

'style/brace-style': ['error', 'stroustrup', { allowSingleLine: true }],

25 +

'style/comma-spacing': ['error', { after: true, before: false }],

26 +

'style/comma-style': ['error', 'last'],

27 +

'style/computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],

28 +

'style/dot-location': ['error', 'property'],

29 +

'style/func-call-spacing': OFF,

30 +

'style/generator-star-spacing': OFF,

31 +

'style/indent': ['error', 2, {

23 32

ArrayExpression: 1,

24 33

CallExpression: { arguments: 1 },

25 34

FunctionDeclaration: { body: 1, parameters: 1 },

@@ -57,29 +66,29 @@ export const javascriptStylistic: FlatESLintConfigItem[] = [

57 66

offsetTernaryExpressions: true,

58 67

outerIIFEBody: 1,

59 68

}],

60 -

'@stylistic/js/key-spacing': ['error', { afterColon: true, beforeColon: false }],

61 -

'@stylistic/js/keyword-spacing': ['error', { after: true, before: true }],

62 -

'@stylistic/js/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],

63 -

'@stylistic/js/multiline-ternary': ['error', 'always-multiline'],

64 -

'@stylistic/js/no-mixed-spaces-and-tabs': 'error',

65 -

'@stylistic/js/no-multi-spaces': 'error',

66 -

'@stylistic/js/no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],

67 -

'@stylistic/js/no-tabs': 'error',

68 -

'@stylistic/js/no-trailing-spaces': 'error',

69 -

'@stylistic/js/no-whitespace-before-property': 'error',

70 -

'@stylistic/js/object-curly-newline': ['error', { consistent: true, multiline: true }],

71 -

'@stylistic/js/object-curly-spacing': ['error', 'always'],

72 -

'@stylistic/js/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],

73 -

'@stylistic/js/operator-linebreak': ['error', 'before'],

74 -

'@stylistic/js/padded-blocks': ['error', { blocks: 'never', classes: 'never', switches: 'never' }],

75 -

'@stylistic/js/rest-spread-spacing': ['error', 'never'],

76 -

'@stylistic/js/semi-spacing': ['error', { after: true, before: false }],

77 -

'@stylistic/js/space-before-blocks': ['error', 'always'],

78 -

'@stylistic/js/space-before-function-paren': ['error', { anonymous: 'always', asyncArrow: 'always', named: 'never' }],

79 -

'@stylistic/js/space-in-parens': ['error', 'never'],

80 -

'@stylistic/js/space-infix-ops': 'error',

81 -

'@stylistic/js/space-unary-ops': ['error', { nonwords: false, words: true }],

82 -

'@stylistic/js/spaced-comment': ['error', 'always', {

69 +

'style/key-spacing': ['error', { afterColon: true, beforeColon: false }],

70 +

'style/keyword-spacing': ['error', { after: true, before: true }],

71 +

'style/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],

72 +

'style/multiline-ternary': ['error', 'always-multiline'],

73 +

'style/no-mixed-spaces-and-tabs': 'error',

74 +

'style/no-multi-spaces': 'error',

75 +

'style/no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],

76 +

'style/no-tabs': 'error',

77 +

'style/no-trailing-spaces': 'error',

78 +

'style/no-whitespace-before-property': 'error',

79 +

'style/object-curly-newline': ['error', { consistent: true, multiline: true }],

80 +

'style/object-curly-spacing': ['error', 'always'],

81 +

'style/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],

82 +

'style/operator-linebreak': ['error', 'before'],

83 +

'style/padded-blocks': ['error', { blocks: 'never', classes: 'never', switches: 'never' }],

84 +

'style/rest-spread-spacing': ['error', 'never'],

85 +

'style/semi-spacing': ['error', { after: true, before: false }],

86 +

'style/space-before-blocks': ['error', 'always'],

87 +

'style/space-before-function-paren': ['error', { anonymous: 'always', asyncArrow: 'always', named: 'never' }],

88 +

'style/space-in-parens': ['error', 'never'],

89 +

'style/space-infix-ops': 'error',

90 +

'style/space-unary-ops': ['error', { nonwords: false, words: true }],

91 +

'style/spaced-comment': ['error', 'always', {

83 92

block: {

84 93

balanced: true,

85 94

exceptions: ['*'],

@@ -90,51 +99,61 @@ export const javascriptStylistic: FlatESLintConfigItem[] = [

90 99

markers: ['/'],

91 100

},

92 101

}],

93 -

'@stylistic/js/template-curly-spacing': 'error',

94 -

'@stylistic/js/template-tag-spacing': ['error', 'never'],

95 -

'@stylistic/js/yield-star-spacing': ['error', 'both'],

96 - 97 -

'antfu/if-newline': 'error',

98 -

'comma-dangle': ['error', 'always-multiline'],

99 -

'curly': ['error', 'multi-or-nest', 'consistent'],

100 -

'quotes': ['error', 'single'],

101 -

'semi': ['error', 'never'],

102 +

'style/template-curly-spacing': 'error',

103 +

'style/template-tag-spacing': ['error', 'never'],

104 +

'style/yield-star-spacing': ['error', 'both'],

102 105

},

103 106

},

104 107

]

105 108 106 109

export const typescriptStylistic: FlatESLintConfigItem[] = [

107 110

{

108 111

plugins: {

109 -

'@stylistic/js': pluginStylisticJs,

110 -

'@stylistic/ts': pluginStylisticTs,

112 +

'style-ts': pluginStylisticTs,

113 +

'ts': pluginTs as any,

111 114

},

112 115

rules: {

113 -

...stylisticJsToTS(rules),

114 -

'@stylistic/ts/member-delimiter-style': ['error', { multiline: { delimiter: 'none' } }],

115 -

'@stylistic/ts/type-annotation-spacing': ['error', {}],

116 +

...stylisticJsToTS(javascriptStylistic[0].rules!),

117 + 118 +

'comma-dangle': OFF,

119 +

'quotes': OFF,

120 +

'semi': OFF,

121 + 122 +

'style-ts/member-delimiter-style': ['error', { multiline: { delimiter: 'none' } }],

123 +

'style-ts/type-annotation-spacing': ['error', {}],

124 + 125 +

'ts/comma-dangle': ['error', 'always-multiline'],

126 +

'ts/quotes': ['error', 'single'],

127 +

'ts/semi': ['error', 'never'],

116 128

},

117 129

},

118 130

]

119 131 120 132

// TODO: move to ESLint Stylistic

121 133

function stylisticJsToTS(input: Record<string, any>) {

122 134

return {

123 -

// turn off all stylistic rules from @stylistic/js

135 +

// turn off all stylistic rules from style

124 136

...Object.fromEntries(

125 137

Object.entries(input)

126 -

.map(([key]) => rules.find(i => i.name === key) ? [key, OFF] : null!)

138 +

.map(([key]) => {

139 +

if (!key.startsWith('style/'))

140 +

return null!

141 +

const basename = key.replace('style/', '')

142 +

if (jsPackage.rules.find(i => i.name === basename))

143 +

return [key, OFF]

144 +

return null!

145 +

})

127 146

.filter(Boolean),

128 147

),

129 -

// rename all stylistic rules from @stylistic/js to @stylistic/ts

148 +

// rename all stylistic rules from style to style/ts

130 149

...Object.fromEntries(

131 150

Object.entries(input)

132 151

.map(([key, value]) => {

133 -

const newKey = key.replace('@stylistic/js', '@stylistic/ts')

134 -

if (newKey === key)

152 +

if (!key.startsWith('style/'))

135 153

return null!

136 -

return rules.find(i => i.name === newKey)

137 -

? [key.replace('@stylistic/js', '@stylistic/ts'), value]

154 +

const basename = key.replace('style/', '')

155 +

return tsPackage.rules.find(i => i.name === basename)

156 +

? [`style-ts/${basename}`, value]

138 157

: null!

139 158

})

140 159

.filter(Boolean),


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4