Skip to content

Commit f9d8a21

Browse files
authored
fix: add meta to plugin (#1102)
1 parent 03fc476 commit f9d8a21

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎packages/eslint-plugin/configs/customize.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ type Rules = Partial<{
1313
* A factory function to customize the recommended config
1414
*/
1515
export 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 = /^@stylistic\//
200+
if (pluginName !== defaultPluginName) {
201+
const regex = new RegExp(`^${defaultPluginName}/`)
200202
rules = Object.fromEntries(
201203
Object.entries(rules!)
202204
.map(([ruleName, ruleConfig]) => [

‎packages/eslint-plugin/src/plugin.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
import { name, version } from '../package.json' with { type: 'json' }
12
import rules from '../rules'
23

34
const plugin = {
5+
meta: {
6+
name,
7+
version,
8+
namespace: '@stylistic',
9+
},
410
rules,
511
}
612

0 commit comments

Comments
 (0)