File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ type Rules = Partial<{
1313 * A factory function to customize the recommended config
1414 */
1515export function customize ( options : StylisticCustomizeOptions = { } ) : Linter . Config {
16+ const defaultPluginName = plugin . meta . namespace
17+
1618 const {
1719 arrowParens = false ,
1820 blockSpacing = true ,
@@ -21,7 +23,7 @@ export function customize(options: StylisticCustomizeOptions = {}): Linter.Confi
2123 experimental : enableExperimentalRules = false ,
2224 indent = 2 ,
2325 jsx = true ,
24- pluginName = '@stylistic' ,
26+ pluginName = defaultPluginName ,
2527 quoteProps = 'consistent-as-needed' ,
2628 quotes = 'single' ,
2729 semi = false ,
@@ -195,8 +197,8 @@ export function customize(options: StylisticCustomizeOptions = {}): Linter.Confi
195197 }
196198 }
197199
198- if ( pluginName !== '@stylistic' ) {
199- const regex = / ^ @ s t y l i s t i c \/ /
200+ if ( pluginName !== defaultPluginName ) {
201+ const regex = new RegExp ( `^ ${ defaultPluginName } /` )
200202 rules = Object . fromEntries (
201203 Object . entries ( rules ! )
202204 . map ( ( [ ruleName , ruleConfig ] ) => [
Original file line number Diff line number Diff line change 1+ import { name , version } from '../package.json' with { type : 'json' }
12import rules from '../rules'
23
34const plugin = {
5+ meta : {
6+ name,
7+ version,
8+ namespace : '@stylistic' ,
9+ } ,
410 rules,
511}
612
You can’t perform that action at this time.
0 commit comments