@imranbarbhuiya/oxc-config 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"central-icons.js","names":[],"sources":["../../src/plugins/central-icons.ts"],"sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\n\nconst CENTRAL_ICONS_PACKAGE_RE = /^@central-icons-react(?:-native)?\\/[^/]+$/;\n\nfunction centralIconSubpath(iconName: string) {\n\tif (iconName.endsWith('Default')) return iconName.slice(0, -'Default'.length);\n\treturn iconName;\n}\n\nconst noCentralIconsBarrelImport: TSESLint.RuleModule<'barrelImport' | 'unsupportedImport', []> = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t'Disallow barrel imports from @central-icons-react and @central-icons-react-native packages; use direct subpath imports instead',\n\t\t},\n\t\tfixable: 'code',\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tbarrelImport:\n\t\t\t\t'Avoid barrel imports from `{{source}}`. Import icons directly from `{{source}}/<IconName>` to keep the bundler from opening thousands of icon files.',\n\t\t\tunsupportedImport:\n\t\t\t\t'Only named icon imports can be autofixed. Use direct subpath default imports from `{{source}}/<IconName>`.',\n\t\t},\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\treturn {\n\t\t\tImportDeclaration(node) {\n\t\t\t\tconst source = node.source.value;\n\t\t\t\tif (typeof source !== 'string' || !CENTRAL_ICONS_PACKAGE_RE.test(source)) return;\n\n\t\t\t\tconst namedSpecifiers = node.specifiers.filter((specifier) => specifier.type === 'ImportSpecifier');\n\t\t\t\tif (namedSpecifiers.length === 0 || namedSpecifiers.length !== node.specifiers.length) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'unsupportedImport',\n\t\t\t\t\t\tdata: { source },\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'barrelImport',\n\t\t\t\t\tdata: { source },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst quote = node.source.raw.startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\tconst fixedImports = namedSpecifiers.map((specifier) => {\n\t\t\t\t\t\t\tconst imported = specifier.imported;\n\t\t\t\t\t\t\tconst importedName = imported.type === 'Identifier' ? imported.name : imported.value;\n\t\t\t\t\t\t\tconst localName = specifier.local.name;\n\t\t\t\t\t\t\tconst typePrefix = node.importKind === 'type' || specifier.importKind === 'type' ? 'type ' : '';\n\t\t\t\t\t\t\tconst subpath = centralIconSubpath(importedName);\n\t\t\t\t\t\t\treturn `import ${typePrefix}${localName} from ${quote}${source}/${subpath}${quote};`;\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn fixer.replaceText(node, fixedImports.join('\\n'));\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nconst plugin: TSESLint.FlatConfig.Plugin = {\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-central-icons',\n\t\tversion: '1.0.0',\n\t},\n\trules: {\n\t\t'no-central-icons-barrel-import': noCentralIconsBarrelImport,\n\t},\n};\n\nexport default plugin;\n"],"mappings":";AAEA,MAAM,2BAA2B;AAEjC,SAAS,mBAAmB,UAAkB;CAC7C,IAAI,SAAS,SAAS,SAAS,GAAG,OAAO,SAAS,MAAM,GAAG,EAAiB;CAC5E,OAAO;AACR;AAyDA,MAAM,SAAqC;CAC1C,MAAM;EACL,MAAM;EACN,SAAS;CACV;CACA,OAAO,EACN,kCAAkC;EA5DnC,MAAM;GACL,MAAM;GACN,MAAM,EACL,aACC,iIACF;GACA,SAAS;GACT,QAAQ,CAAC;GACT,UAAU;IACT,cACC;IACD,mBACC;GACF;EACD;EACA,gBAAgB,CAAC;EACjB,OAAO,SAAS;GACf,OAAO,EACN,kBAAkB,MAAM;IACvB,MAAM,SAAS,KAAK,OAAO;IAC3B,IAAI,OAAO,WAAW,YAAY,CAAC,yBAAyB,KAAK,MAAM,GAAG;IAE1E,MAAM,kBAAkB,KAAK,WAAW,QAAQ,cAAc,UAAU,SAAS,iBAAiB;IAClG,IAAI,gBAAgB,WAAW,KAAK,gBAAgB,WAAW,KAAK,WAAW,QAAQ;KACtF,QAAQ,OAAO;MACd;MACA,WAAW;MACX,MAAM,EAAE,OAAO;KAChB,CAAC;KACD;IACD;IAEA,QAAQ,OAAO;KACd;KACA,WAAW;KACX,MAAM,EAAE,OAAO;KACf,IAAI,OAAO;MACV,MAAM,QAAQ,KAAK,OAAO,IAAI,WAAW,GAAG,IAAI,MAAM;MACtD,MAAM,eAAe,gBAAgB,KAAK,cAAc;OACvD,MAAM,WAAW,UAAU;OAC3B,MAAM,eAAe,SAAS,SAAS,eAAe,SAAS,OAAO,SAAS;OAC/E,MAAM,YAAY,UAAU,MAAM;OAClC,MAAM,aAAa,KAAK,eAAe,UAAU,UAAU,eAAe,SAAS,UAAU;OAC7F,MAAM,UAAU,mBAAmB,YAAY;OAC/C,OAAO,UAAU,aAAa,UAAU,QAAQ,QAAQ,OAAO,GAAG,UAAU,MAAM;MACnF,CAAC;MACD,OAAO,MAAM,YAAY,MAAM,aAAa,KAAK,IAAI,CAAC;KACvD;IACD,CAAC;GACF,EACD;EACD;CAS4D,EAC5D;AACD"}
1
+ {"version":3,"file":"central-icons.js","names":[],"sources":["../../src/plugins/central-icons.ts"],"sourcesContent":["import { definePlugin, defineRule } from '@oxlint/plugins';\n\nconst CENTRAL_ICONS_PACKAGE_RE = /^@central-icons-react(?:-native)?\\/[^/]+$/;\n\nfunction centralIconSubpath(iconName: string) {\n\tif (iconName.endsWith('Default')) return iconName.slice(0, -'Default'.length);\n\treturn iconName;\n}\n\nconst noCentralIconsBarrelImport = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t'Disallow barrel imports from @central-icons-react and @central-icons-react-native packages; use direct subpath imports instead',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\tbarrelImport:\n\t\t\t\t'Avoid barrel imports from `{{source}}`. Import icons directly from `{{source}}/<IconName>` to keep the bundler from opening thousands of icon files.',\n\t\t\tunsupportedImport:\n\t\t\t\t'Only named icon imports can be autofixed. Use direct subpath default imports from `{{source}}/<IconName>`.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tImportDeclaration(node) {\n\t\t\t\tconst source = node.source.value;\n\t\t\t\tif (typeof source !== 'string' || !CENTRAL_ICONS_PACKAGE_RE.test(source)) return;\n\n\t\t\t\tconst namedSpecifiers = node.specifiers.filter((specifier) => specifier.type === 'ImportSpecifier');\n\t\t\t\tif (namedSpecifiers.length === 0 || namedSpecifiers.length !== node.specifiers.length) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'unsupportedImport',\n\t\t\t\t\t\tdata: { source },\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'barrelImport',\n\t\t\t\t\tdata: { source },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst quote = (node.source.raw ?? '\"').startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\tconst fixedImports = namedSpecifiers.map((specifier) => {\n\t\t\t\t\t\t\tconst imported = specifier.imported;\n\t\t\t\t\t\t\tconst importedName = imported.type === 'Identifier' ? imported.name : imported.value;\n\t\t\t\t\t\t\tconst localName = specifier.local.name;\n\t\t\t\t\t\t\tconst typePrefix = node.importKind === 'type' || specifier.importKind === 'type' ? 'type ' : '';\n\t\t\t\t\t\t\tconst subpath = centralIconSubpath(importedName);\n\t\t\t\t\t\t\treturn `import ${typePrefix}${localName} from ${quote}${source}/${subpath}${quote};`;\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn fixer.replaceText(node, fixedImports.join('\\n'));\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n});\n\nexport default definePlugin({\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-central-icons',\n\t},\n\trules: {\n\t\t'no-central-icons-barrel-import': noCentralIconsBarrelImport,\n\t},\n});\n"],"mappings":";;;AAEA,MAAM,2BAA2B;AAEjC,SAAS,mBAAmB,UAAkB;CAC7C,IAAI,SAAS,SAAS,SAAS,GAAG,OAAO,SAAS,MAAM,GAAG,EAAiB;CAC5E,OAAO;AACR;AAEA,MAAM,6BAA6B,WAAW;CAC7C,MAAM;EACL,MAAM;EACN,MAAM,EACL,aACC,iIACF;EACA,SAAS;EACT,UAAU;GACT,cACC;GACD,mBACC;EACF;CACD;CACA,WAAW,SAAS;EACnB,OAAO,EACN,kBAAkB,MAAM;GACvB,MAAM,SAAS,KAAK,OAAO;GAC3B,IAAI,OAAO,WAAW,YAAY,CAAC,yBAAyB,KAAK,MAAM,GAAG;GAE1E,MAAM,kBAAkB,KAAK,WAAW,QAAQ,cAAc,UAAU,SAAS,iBAAiB;GAClG,IAAI,gBAAgB,WAAW,KAAK,gBAAgB,WAAW,KAAK,WAAW,QAAQ;IACtF,QAAQ,OAAO;KACd;KACA,WAAW;KACX,MAAM,EAAE,OAAO;IAChB,CAAC;IACD;GACD;GAEA,QAAQ,OAAO;IACd;IACA,WAAW;IACX,MAAM,EAAE,OAAO;IACf,IAAI,OAAO;KACV,MAAM,SAAS,KAAK,OAAO,OAAO,KAAG,CAAE,WAAW,GAAG,IAAI,MAAM;KAC/D,MAAM,eAAe,gBAAgB,KAAK,cAAc;MACvD,MAAM,WAAW,UAAU;MAC3B,MAAM,eAAe,SAAS,SAAS,eAAe,SAAS,OAAO,SAAS;MAC/E,MAAM,YAAY,UAAU,MAAM;MAClC,MAAM,aAAa,KAAK,eAAe,UAAU,UAAU,eAAe,SAAS,UAAU;MAC7F,MAAM,UAAU,mBAAmB,YAAY;MAC/C,OAAO,UAAU,aAAa,UAAU,QAAQ,QAAQ,OAAO,GAAG,UAAU,MAAM;KACnF,CAAC;KACD,OAAO,MAAM,YAAY,MAAM,aAAa,KAAK,IAAI,CAAC;IACvD;GACD,CAAC;EACF,EACD;CACD;AACD,CAAC;AAED,4BAAe,aAAa;CAC3B,MAAM,EACL,MAAM,oCACP;CACA,OAAO,EACN,kCAAkC,2BACnC;AACD,CAAC"}
@@ -1,6 +1,5 @@
1
- import { TSESLint } from "@typescript-eslint/utils";
2
1
  //#region src/plugins/i18n.d.ts
3
- declare const plugin: TSESLint.FlatConfig.Plugin;
2
+ declare const _default: import("@oxlint/plugins").Plugin;
4
3
  //#endregion
5
- export { plugin as default };
4
+ export { _default as default };
6
5
  //# sourceMappingURL=i18n.d.ts.map
@@ -1,58 +1,55 @@
1
+ import { definePlugin, defineRule } from "@oxlint/plugins";
2
+
1
3
  //#region src/plugins/i18n.ts
2
- const plugin = {
4
+ const staticTArguments = defineRule({
3
5
  meta: {
4
- name: "eslint-plugin-mahir-i18n",
5
- version: "1.0.0"
6
+ type: "problem",
7
+ docs: { description: "Require t() calls to use static string literals so next-intl can extract messages at build time" },
8
+ messages: { staticArgument: "`t()` must receive a static string literal. Dynamic expressions cannot be extracted by next-intl. Use separate `t(\"Key\")` calls instead." }
6
9
  },
7
- rules: {
8
- "static-t-arguments": {
9
- meta: {
10
- type: "problem",
11
- docs: { description: "Require t() calls to use static string literals so next-intl can extract messages at build time" },
12
- schema: [],
13
- messages: { staticArgument: "`t()` must receive a static string literal. Dynamic expressions cannot be extracted by next-intl. Use separate `t(\"Key\")` calls instead." }
14
- },
15
- defaultOptions: [],
16
- create(context) {
17
- return { CallExpression(node) {
18
- if (node.callee.type !== "Identifier" || node.callee.name !== "t") return;
19
- if (node.arguments.length === 0) return;
20
- const firstArg = node.arguments[0];
21
- if (firstArg.type !== "Literal" || typeof firstArg.value !== "string") context.report({
22
- node: firstArg,
23
- messageId: "staticArgument"
24
- });
25
- } };
26
- }
27
- },
28
- "no-t-as-parameter": {
29
- meta: {
30
- type: "problem",
31
- docs: { description: "Disallow passing the `t` translation function as an argument to other functions or components" },
32
- schema: [],
33
- messages: { noTParam: "Do not pass `t` as an argument. Call `useExtracted()` or `getExtracted()` directly in the consuming component/function instead." }
10
+ createOnce(context) {
11
+ return { CallExpression(node) {
12
+ if (node.callee.type !== "Identifier" || node.callee.name !== "t") return;
13
+ if (node.arguments.length === 0) return;
14
+ const firstArg = node.arguments[0];
15
+ if (firstArg.type !== "Literal" || typeof firstArg.value !== "string") context.report({
16
+ node: firstArg,
17
+ messageId: "staticArgument"
18
+ });
19
+ } };
20
+ }
21
+ });
22
+ const noTAsParameter = defineRule({
23
+ meta: {
24
+ type: "problem",
25
+ docs: { description: "Disallow passing the `t` translation function as an argument to other functions or components" },
26
+ messages: { noTParam: "Do not pass `t` as an argument. Call `useExtracted()` or `getExtracted()` directly in the consuming component/function instead." }
27
+ },
28
+ createOnce(context) {
29
+ return {
30
+ CallExpression(node) {
31
+ for (const arg of node.arguments) if (arg.type === "Identifier" && arg.name === "t") context.report({
32
+ node: arg,
33
+ messageId: "noTParam"
34
+ });
34
35
  },
35
- defaultOptions: [],
36
- create(context) {
37
- return {
38
- CallExpression(node) {
39
- for (const arg of node.arguments) if (arg.type === "Identifier" && arg.name === "t") context.report({
40
- node: arg,
41
- messageId: "noTParam"
42
- });
43
- },
44
- JSXAttribute(node) {
45
- if (node.value?.type === "JSXExpressionContainer" && node.value.expression.type === "Identifier" && node.value.expression.name === "t") context.report({
46
- node: node.value.expression,
47
- messageId: "noTParam"
48
- });
49
- }
50
- };
36
+ JSXAttribute(node) {
37
+ if (node.value?.type === "JSXExpressionContainer" && node.value.expression.type === "Identifier" && node.value.expression.name === "t") context.report({
38
+ node: node.value.expression,
39
+ messageId: "noTParam"
40
+ });
51
41
  }
52
- }
42
+ };
43
+ }
44
+ });
45
+ var i18n_default = definePlugin({
46
+ meta: { name: "eslint-plugin-mahir-i18n" },
47
+ rules: {
48
+ "static-t-arguments": staticTArguments,
49
+ "no-t-as-parameter": noTAsParameter
53
50
  }
54
- };
51
+ });
55
52
 
56
53
  //#endregion
57
- export { plugin as default };
54
+ export { i18n_default as default };
58
55
  //# sourceMappingURL=i18n.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","names":[],"sources":["../../src/plugins/i18n.ts"],"sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\n\nconst staticTArguments: TSESLint.RuleModule<'staticArgument', []> = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Require t() calls to use static string literals so next-intl can extract messages at build time',\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tstaticArgument:\n\t\t\t\t'`t()` must receive a static string literal. Dynamic expressions cannot be extracted by next-intl. Use separate `t(\"Key\")` calls instead.',\n\t\t},\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tif (node.callee.type !== 'Identifier' || node.callee.name !== 't') return;\n\t\t\t\tif (node.arguments.length === 0) return;\n\t\t\t\tconst firstArg = node.arguments[0];\n\t\t\t\tif (firstArg.type !== 'Literal' || typeof firstArg.value !== 'string')\n\t\t\t\t\tcontext.report({ node: firstArg, messageId: 'staticArgument' });\n\t\t\t},\n\t\t};\n\t},\n};\n\nconst noTAsParameter: TSESLint.RuleModule<'noTParam', []> = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow passing the `t` translation function as an argument to other functions or components',\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tnoTParam:\n\t\t\t\t'Do not pass `t` as an argument. Call `useExtracted()` or `getExtracted()` directly in the consuming component/function instead.',\n\t\t},\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tfor (const arg of node.arguments)\n\t\t\t\t\tif (arg.type === 'Identifier' && arg.name === 't') context.report({ node: arg, messageId: 'noTParam' });\n\t\t\t},\n\t\t\tJSXAttribute(node) {\n\t\t\t\tif (\n\t\t\t\t\tnode.value?.type === 'JSXExpressionContainer' &&\n\t\t\t\t\tnode.value.expression.type === 'Identifier' &&\n\t\t\t\t\tnode.value.expression.name === 't'\n\t\t\t\t)\n\t\t\t\t\tcontext.report({ node: node.value.expression, messageId: 'noTParam' });\n\t\t\t},\n\t\t};\n\t},\n};\n\nconst plugin: TSESLint.FlatConfig.Plugin = {\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-i18n',\n\t\tversion: '1.0.0',\n\t},\n\trules: {\n\t\t'static-t-arguments': staticTArguments,\n\t\t'no-t-as-parameter': noTAsParameter,\n\t},\n};\n\nexport default plugin;\n"],"mappings":";AA2DA,MAAM,SAAqC;CAC1C,MAAM;EACL,MAAM;EACN,SAAS;CACV;CACA,OAAO;EACN,sBAAsB;GA9DvB,MAAM;IACL,MAAM;IACN,MAAM,EACL,aAAa,kGACd;IACA,QAAQ,CAAC;IACT,UAAU,EACT,gBACC,6IACF;GACD;GACA,gBAAgB,CAAC;GACjB,OAAO,SAAS;IACf,OAAO,EACN,eAAe,MAAM;KACpB,IAAI,KAAK,OAAO,SAAS,gBAAgB,KAAK,OAAO,SAAS,KAAK;KACnE,IAAI,KAAK,UAAU,WAAW,GAAG;KACjC,MAAM,WAAW,KAAK,UAAU;KAChC,IAAI,SAAS,SAAS,aAAa,OAAO,SAAS,UAAU,UAC5D,QAAQ,OAAO;MAAE,MAAM;MAAU,WAAW;KAAiB,CAAC;IAChE,EACD;GACD;EAwCsC;EACrC,qBAAqB;GArCtB,MAAM;IACL,MAAM;IACN,MAAM,EACL,aAAa,gGACd;IACA,QAAQ,CAAC;IACT,UAAU,EACT,UACC,kIACF;GACD;GACA,gBAAgB,CAAC;GACjB,OAAO,SAAS;IACf,OAAO;KACN,eAAe,MAAM;MACpB,KAAK,MAAM,OAAO,KAAK,WACtB,IAAI,IAAI,SAAS,gBAAgB,IAAI,SAAS,KAAK,QAAQ,OAAO;OAAE,MAAM;OAAK,WAAW;MAAW,CAAC;KACxG;KACA,aAAa,MAAM;MAClB,IACC,KAAK,OAAO,SAAS,4BACrB,KAAK,MAAM,WAAW,SAAS,gBAC/B,KAAK,MAAM,WAAW,SAAS,KAE/B,QAAQ,OAAO;OAAE,MAAM,KAAK,MAAM;OAAY,WAAW;MAAW,CAAC;KACvE;IACD;GACD;EAUmC;CACnC;AACD"}
1
+ {"version":3,"file":"i18n.js","names":[],"sources":["../../src/plugins/i18n.ts"],"sourcesContent":["import { definePlugin, defineRule } from '@oxlint/plugins';\n\nconst staticTArguments = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Require t() calls to use static string literals so next-intl can extract messages at build time',\n\t\t},\n\t\tmessages: {\n\t\t\tstaticArgument:\n\t\t\t\t'`t()` must receive a static string literal. Dynamic expressions cannot be extracted by next-intl. Use separate `t(\"Key\")` calls instead.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tif (node.callee.type !== 'Identifier' || node.callee.name !== 't') return;\n\t\t\t\tif (node.arguments.length === 0) return;\n\t\t\t\tconst firstArg = node.arguments[0];\n\t\t\t\tif (firstArg.type !== 'Literal' || typeof firstArg.value !== 'string')\n\t\t\t\t\tcontext.report({ node: firstArg, messageId: 'staticArgument' });\n\t\t\t},\n\t\t};\n\t},\n});\n\nconst noTAsParameter = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow passing the `t` translation function as an argument to other functions or components',\n\t\t},\n\t\tmessages: {\n\t\t\tnoTParam:\n\t\t\t\t'Do not pass `t` as an argument. Call `useExtracted()` or `getExtracted()` directly in the consuming component/function instead.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tfor (const arg of node.arguments)\n\t\t\t\t\tif (arg.type === 'Identifier' && arg.name === 't') context.report({ node: arg, messageId: 'noTParam' });\n\t\t\t},\n\t\t\tJSXAttribute(node) {\n\t\t\t\tif (\n\t\t\t\t\tnode.value?.type === 'JSXExpressionContainer' &&\n\t\t\t\t\tnode.value.expression.type === 'Identifier' &&\n\t\t\t\t\tnode.value.expression.name === 't'\n\t\t\t\t)\n\t\t\t\t\tcontext.report({ node: node.value.expression, messageId: 'noTParam' });\n\t\t\t},\n\t\t};\n\t},\n});\n\nexport default definePlugin({\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-i18n',\n\t},\n\trules: {\n\t\t'static-t-arguments': staticTArguments,\n\t\t'no-t-as-parameter': noTAsParameter,\n\t},\n});\n"],"mappings":";;;AAEA,MAAM,mBAAmB,WAAW;CACnC,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,kGACd;EACA,UAAU,EACT,gBACC,6IACF;CACD;CACA,WAAW,SAAS;EACnB,OAAO,EACN,eAAe,MAAM;GACpB,IAAI,KAAK,OAAO,SAAS,gBAAgB,KAAK,OAAO,SAAS,KAAK;GACnE,IAAI,KAAK,UAAU,WAAW,GAAG;GACjC,MAAM,WAAW,KAAK,UAAU;GAChC,IAAI,SAAS,SAAS,aAAa,OAAO,SAAS,UAAU,UAC5D,QAAQ,OAAO;IAAE,MAAM;IAAU,WAAW;GAAiB,CAAC;EAChE,EACD;CACD;AACD,CAAC;AAED,MAAM,iBAAiB,WAAW;CACjC,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,gGACd;EACA,UAAU,EACT,UACC,kIACF;CACD;CACA,WAAW,SAAS;EACnB,OAAO;GACN,eAAe,MAAM;IACpB,KAAK,MAAM,OAAO,KAAK,WACtB,IAAI,IAAI,SAAS,gBAAgB,IAAI,SAAS,KAAK,QAAQ,OAAO;KAAE,MAAM;KAAK,WAAW;IAAW,CAAC;GACxG;GACA,aAAa,MAAM;IAClB,IACC,KAAK,OAAO,SAAS,4BACrB,KAAK,MAAM,WAAW,SAAS,gBAC/B,KAAK,MAAM,WAAW,SAAS,KAE/B,QAAQ,OAAO;KAAE,MAAM,KAAK,MAAM;KAAY,WAAW;IAAW,CAAC;GACvE;EACD;CACD;AACD,CAAC;AAED,mBAAe,aAAa;CAC3B,MAAM,EACL,MAAM,2BACP;CACA,OAAO;EACN,sBAAsB;EACtB,qBAAqB;CACtB;AACD,CAAC"}
@@ -1,6 +1,5 @@
1
- import { TSESLint } from "@typescript-eslint/utils";
2
1
  //#region src/plugins/native-tailwind.d.ts
3
- declare const plugin: TSESLint.FlatConfig.Plugin;
2
+ declare const _default: import("@oxlint/plugins").Plugin;
4
3
  //#endregion
5
- export { plugin as default };
4
+ export { _default as default };
6
5
  //# sourceMappingURL=native-tailwind.d.ts.map
@@ -1,110 +1,108 @@
1
+ import { definePlugin, defineRule } from "@oxlint/plugins";
2
+
1
3
  //#region src/plugins/native-tailwind.ts
2
- const plugin = {
4
+ const FORBIDDEN = /* @__PURE__ */ new Set(["flex-col"]);
5
+ const classNameRules = defineRule({
3
6
  meta: {
4
- name: "eslint-plugin-mahir-native-tailwind",
5
- version: "1.0.0"
6
- },
7
- rules: { "class-name-rules": {
8
- meta: {
9
- type: "problem",
10
- docs: { description: "Disallow Tailwind flex-col, and standalone flex" },
11
- fixable: "code",
12
- schema: [],
13
- messages: {
14
- forbidden: "Class '{{cls}}' is the default in react-native, so no need to explicitly set it.",
15
- flexOnly: "Class 'flex' should be removed or changed to 'flex-row' for explicit direction."
16
- },
17
- hasSuggestions: true
7
+ type: "problem",
8
+ docs: { description: "Disallow Tailwind flex-col, and standalone flex" },
9
+ fixable: "code",
10
+ messages: {
11
+ forbidden: "Class '{{cls}}' is the default in react-native, so no need to explicitly set it.",
12
+ flexOnly: "Class 'flex' should be removed or changed to 'flex-row' for explicit direction."
18
13
  },
19
- defaultOptions: [],
20
- create(context) {
21
- const FORBIDDEN = /* @__PURE__ */ new Set(["flex-col"]);
22
- function reportAndFix(node, text, raw) {
23
- const classes = text.trim().split(/\s+/);
24
- const hasFlex = classes.includes("flex");
25
- const hasFlexCol = classes.includes("flex-col");
26
- const hasFlexRow = classes.includes("flex-row");
27
- const offendingForbidden = classes.filter((cl) => FORBIDDEN.has(cl));
28
- if (!hasFlex && offendingForbidden.length === 0) return;
29
- if (hasFlex && hasFlexRow) {
30
- context.report({
31
- node,
32
- messageId: "forbidden",
33
- data: { cls: "flex, flex-row" },
34
- fix(fixer) {
35
- const finalClasses = classes.filter((cl) => cl !== "flex" && !FORBIDDEN.has(cl)).join(" ");
36
- const quote = raw.startsWith("'") ? "'" : "\"";
37
- return fixer.replaceText(node, `${quote}${finalClasses}${quote}`);
38
- }
39
- });
40
- return;
41
- }
42
- if (hasFlex && hasFlexCol) {
43
- context.report({
44
- node,
45
- messageId: "forbidden",
46
- data: { cls: "flex, flex-col" },
47
- fix(fixer) {
48
- const finalClasses = classes.filter((cl) => cl !== "flex" && cl !== "flex-col" && !FORBIDDEN.has(cl)).join(" ");
49
- const quote = raw.startsWith("'") ? "'" : "\"";
50
- return fixer.replaceText(node, `${quote}${finalClasses}${quote}`);
51
- }
52
- });
53
- return;
54
- }
55
- if (hasFlexCol && !hasFlex) {
56
- context.report({
57
- node,
58
- messageId: "forbidden",
59
- data: { cls: "flex-col" },
60
- fix(fixer) {
61
- const finalClasses = classes.filter((cl) => cl !== "flex-col" && !FORBIDDEN.has(cl)).join(" ");
62
- const quote = raw.startsWith("'") ? "'" : "\"";
63
- return fixer.replaceText(node, `${quote}${finalClasses}${quote}`);
64
- }
65
- });
66
- return;
67
- }
68
- if (hasFlex && !hasFlexCol) {
69
- context.report({
70
- node,
71
- messageId: "flexOnly",
72
- data: { cls: "flex" },
73
- suggest: [{
74
- messageId: "flexOnly",
75
- data: { cls: "flex" },
76
- fix(fixer) {
77
- const finalClasses = classes.map((cl) => cl === "flex" ? "flex-row" : cl).join(" ");
78
- const quote = raw.startsWith("'") ? "'" : "\"";
79
- return fixer.replaceText(node, `${quote}${finalClasses}${quote}`);
80
- }
81
- }]
82
- });
83
- return;
84
- }
85
- if (offendingForbidden.length > 0) context.report({
14
+ hasSuggestions: true
15
+ },
16
+ createOnce(context) {
17
+ function reportAndFix(node, text, raw) {
18
+ const classes = text.trim().split(/\s+/);
19
+ const hasFlex = classes.includes("flex");
20
+ const hasFlexCol = classes.includes("flex-col");
21
+ const hasFlexRow = classes.includes("flex-row");
22
+ const offendingForbidden = classes.filter((cl) => FORBIDDEN.has(cl));
23
+ if (!hasFlex && offendingForbidden.length === 0) return;
24
+ if (hasFlex && hasFlexRow) {
25
+ context.report({
86
26
  node,
87
27
  messageId: "forbidden",
88
- data: { cls: offendingForbidden.join(", ") },
28
+ data: { cls: "flex, flex-row" },
89
29
  fix(fixer) {
90
- const finalClasses = classes.filter((cl) => !FORBIDDEN.has(cl)).join(" ");
91
- const quote = raw.startsWith("'") ? "'" : "\"";
30
+ const finalClasses = classes.filter((cl) => cl !== "flex" && !FORBIDDEN.has(cl)).join(" ");
31
+ const quote = (raw ?? "\"").startsWith("'") ? "'" : "\"";
92
32
  return fixer.replaceText(node, `${quote}${finalClasses}${quote}`);
93
33
  }
94
34
  });
35
+ return;
95
36
  }
96
- return { JSXAttribute(attr) {
97
- if (attr.name.type !== "JSXIdentifier" || attr.name.name !== "className") return;
98
- if (attr.value?.type === "Literal" && typeof attr.value.value === "string") {
99
- reportAndFix(attr.value, attr.value.value, attr.value.raw);
100
- return;
37
+ if (hasFlex && hasFlexCol) {
38
+ context.report({
39
+ node,
40
+ messageId: "forbidden",
41
+ data: { cls: "flex, flex-col" },
42
+ fix(fixer) {
43
+ const finalClasses = classes.filter((cl) => cl !== "flex" && cl !== "flex-col" && !FORBIDDEN.has(cl)).join(" ");
44
+ const quote = (raw ?? "\"").startsWith("'") ? "'" : "\"";
45
+ return fixer.replaceText(node, `${quote}${finalClasses}${quote}`);
46
+ }
47
+ });
48
+ return;
49
+ }
50
+ if (hasFlexCol && !hasFlex) {
51
+ context.report({
52
+ node,
53
+ messageId: "forbidden",
54
+ data: { cls: "flex-col" },
55
+ fix(fixer) {
56
+ const finalClasses = classes.filter((cl) => cl !== "flex-col" && !FORBIDDEN.has(cl)).join(" ");
57
+ const quote = (raw ?? "\"").startsWith("'") ? "'" : "\"";
58
+ return fixer.replaceText(node, `${quote}${finalClasses}${quote}`);
59
+ }
60
+ });
61
+ return;
62
+ }
63
+ if (hasFlex && !hasFlexCol) {
64
+ context.report({
65
+ node,
66
+ messageId: "flexOnly",
67
+ data: { cls: "flex" },
68
+ suggest: [{
69
+ messageId: "flexOnly",
70
+ data: { cls: "flex" },
71
+ fix(fixer) {
72
+ const finalClasses = classes.map((cl) => cl === "flex" ? "flex-row" : cl).join(" ");
73
+ const quote = (raw ?? "\"").startsWith("'") ? "'" : "\"";
74
+ return fixer.replaceText(node, `${quote}${finalClasses}${quote}`);
75
+ }
76
+ }]
77
+ });
78
+ return;
79
+ }
80
+ if (offendingForbidden.length > 0) context.report({
81
+ node,
82
+ messageId: "forbidden",
83
+ data: { cls: offendingForbidden.join(", ") },
84
+ fix(fixer) {
85
+ const finalClasses = classes.filter((cl) => !FORBIDDEN.has(cl)).join(" ");
86
+ const quote = (raw ?? "\"").startsWith("'") ? "'" : "\"";
87
+ return fixer.replaceText(node, `${quote}${finalClasses}${quote}`);
101
88
  }
102
- if (attr.value?.type === "JSXExpressionContainer" && attr.value.expression.type === "Literal" && typeof attr.value.expression.value === "string") reportAndFix(attr.value.expression, attr.value.expression.value, attr.value.expression.raw);
103
- } };
89
+ });
104
90
  }
105
- } }
106
- };
91
+ return { JSXAttribute(attr) {
92
+ if (attr.name.type !== "JSXIdentifier" || attr.name.name !== "className") return;
93
+ if (attr.value?.type === "Literal" && typeof attr.value.value === "string") {
94
+ reportAndFix(attr.value, attr.value.value, attr.value.raw);
95
+ return;
96
+ }
97
+ if (attr.value?.type === "JSXExpressionContainer" && attr.value.expression.type === "Literal" && typeof attr.value.expression.value === "string") reportAndFix(attr.value.expression, attr.value.expression.value, attr.value.expression.raw);
98
+ } };
99
+ }
100
+ });
101
+ var native_tailwind_default = definePlugin({
102
+ meta: { name: "eslint-plugin-mahir-native-tailwind" },
103
+ rules: { "class-name-rules": classNameRules }
104
+ });
107
105
 
108
106
  //#endregion
109
- export { plugin as default };
107
+ export { native_tailwind_default as default };
110
108
  //# sourceMappingURL=native-tailwind.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-tailwind.js","names":[],"sources":["../../src/plugins/native-tailwind.ts"],"sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\n\nconst classNameRules: TSESLint.RuleModule<'flexOnly' | 'forbidden', []> = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow Tailwind flex-col, and standalone flex',\n\t\t},\n\t\tfixable: 'code',\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tforbidden: \"Class '{{cls}}' is the default in react-native, so no need to explicitly set it.\",\n\t\t\tflexOnly: \"Class 'flex' should be removed or changed to 'flex-row' for explicit direction.\",\n\t\t},\n\t\thasSuggestions: true,\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\tconst FORBIDDEN = new Set(['flex-col']);\n\n\t\tfunction reportAndFix(node: TSESTree.Node, text: string, raw: string) {\n\t\t\tconst classes = text.trim().split(/\\s+/);\n\t\t\tconst hasFlex = classes.includes('flex');\n\t\t\tconst hasFlexCol = classes.includes('flex-col');\n\t\t\tconst hasFlexRow = classes.includes('flex-row');\n\t\t\tconst offendingForbidden = classes.filter((cl) => FORBIDDEN.has(cl));\n\n\t\t\tif (!hasFlex && offendingForbidden.length === 0) return;\n\n\t\t\tif (hasFlex && hasFlexRow) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'forbidden',\n\t\t\t\t\tdata: { cls: 'flex, flex-row' },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst kept = classes.filter((cl) => cl !== 'flex' && !FORBIDDEN.has(cl));\n\t\t\t\t\t\tconst finalClasses = kept.join(' ');\n\t\t\t\t\t\tconst quote = raw.startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\treturn fixer.replaceText(node, `${quote}${finalClasses}${quote}`);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (hasFlex && hasFlexCol) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'forbidden',\n\t\t\t\t\tdata: { cls: 'flex, flex-col' },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst kept = classes.filter((cl) => cl !== 'flex' && cl !== 'flex-col' && !FORBIDDEN.has(cl));\n\t\t\t\t\t\tconst finalClasses = kept.join(' ');\n\t\t\t\t\t\tconst quote = raw.startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\treturn fixer.replaceText(node, `${quote}${finalClasses}${quote}`);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (hasFlexCol && !hasFlex) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'forbidden',\n\t\t\t\t\tdata: { cls: 'flex-col' },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst kept = classes.filter((cl) => cl !== 'flex-col' && !FORBIDDEN.has(cl));\n\t\t\t\t\t\tconst finalClasses = kept.join(' ');\n\t\t\t\t\t\tconst quote = raw.startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\treturn fixer.replaceText(node, `${quote}${finalClasses}${quote}`);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (hasFlex && !hasFlexCol) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'flexOnly',\n\t\t\t\t\tdata: { cls: 'flex' },\n\t\t\t\t\tsuggest: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmessageId: 'flexOnly',\n\t\t\t\t\t\t\tdata: { cls: 'flex' },\n\t\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\t\tconst replacedClasses = classes.map((cl) => (cl === 'flex' ? 'flex-row' : cl));\n\t\t\t\t\t\t\t\tconst finalClasses = replacedClasses.join(' ');\n\t\t\t\t\t\t\t\tconst quote = raw.startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\t\t\treturn fixer.replaceText(node, `${quote}${finalClasses}${quote}`);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (offendingForbidden.length > 0) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'forbidden',\n\t\t\t\t\tdata: { cls: offendingForbidden.join(', ') },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst kept = classes.filter((cl) => !FORBIDDEN.has(cl));\n\t\t\t\t\t\tconst finalClasses = kept.join(' ');\n\t\t\t\t\t\tconst quote = raw.startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\treturn fixer.replaceText(node, `${quote}${finalClasses}${quote}`);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tJSXAttribute(attr) {\n\t\t\t\tif (attr.name.type !== 'JSXIdentifier' || attr.name.name !== 'className') return;\n\n\t\t\t\tif (attr.value?.type === 'Literal' && typeof attr.value.value === 'string') {\n\t\t\t\t\treportAndFix(attr.value, attr.value.value, attr.value.raw);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tattr.value?.type === 'JSXExpressionContainer' &&\n\t\t\t\t\tattr.value.expression.type === 'Literal' &&\n\t\t\t\t\ttypeof attr.value.expression.value === 'string'\n\t\t\t\t)\n\t\t\t\t\treportAndFix(attr.value.expression, attr.value.expression.value, attr.value.expression.raw);\n\t\t\t},\n\t\t};\n\t},\n};\n\nconst plugin: TSESLint.FlatConfig.Plugin = {\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-native-tailwind',\n\t\tversion: '1.0.0',\n\t},\n\trules: {\n\t\t'class-name-rules': classNameRules,\n\t},\n};\n\nexport default plugin;\n"],"mappings":"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"}
1
+ {"version":3,"file":"native-tailwind.js","names":[],"sources":["../../src/plugins/native-tailwind.ts"],"sourcesContent":["import { definePlugin, defineRule } from '@oxlint/plugins';\n\nimport type { ESTree } from '@oxlint/plugins';\n\nconst FORBIDDEN = new Set(['flex-col']);\n\nconst classNameRules = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow Tailwind flex-col, and standalone flex',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\tforbidden: \"Class '{{cls}}' is the default in react-native, so no need to explicitly set it.\",\n\t\t\tflexOnly: \"Class 'flex' should be removed or changed to 'flex-row' for explicit direction.\",\n\t\t},\n\t\thasSuggestions: true,\n\t},\n\tcreateOnce(context) {\n\t\tfunction reportAndFix(node: ESTree.Node, text: string, raw: string | null) {\n\t\t\tconst classes = text.trim().split(/\\s+/);\n\t\t\tconst hasFlex = classes.includes('flex');\n\t\t\tconst hasFlexCol = classes.includes('flex-col');\n\t\t\tconst hasFlexRow = classes.includes('flex-row');\n\t\t\tconst offendingForbidden = classes.filter((cl) => FORBIDDEN.has(cl));\n\n\t\t\tif (!hasFlex && offendingForbidden.length === 0) return;\n\n\t\t\tif (hasFlex && hasFlexRow) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'forbidden',\n\t\t\t\t\tdata: { cls: 'flex, flex-row' },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst kept = classes.filter((cl) => cl !== 'flex' && !FORBIDDEN.has(cl));\n\t\t\t\t\t\tconst finalClasses = kept.join(' ');\n\t\t\t\t\t\tconst quote = (raw ?? '\"').startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\treturn fixer.replaceText(node, `${quote}${finalClasses}${quote}`);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (hasFlex && hasFlexCol) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'forbidden',\n\t\t\t\t\tdata: { cls: 'flex, flex-col' },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst kept = classes.filter((cl) => cl !== 'flex' && cl !== 'flex-col' && !FORBIDDEN.has(cl));\n\t\t\t\t\t\tconst finalClasses = kept.join(' ');\n\t\t\t\t\t\tconst quote = (raw ?? '\"').startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\treturn fixer.replaceText(node, `${quote}${finalClasses}${quote}`);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (hasFlexCol && !hasFlex) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'forbidden',\n\t\t\t\t\tdata: { cls: 'flex-col' },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst kept = classes.filter((cl) => cl !== 'flex-col' && !FORBIDDEN.has(cl));\n\t\t\t\t\t\tconst finalClasses = kept.join(' ');\n\t\t\t\t\t\tconst quote = (raw ?? '\"').startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\treturn fixer.replaceText(node, `${quote}${finalClasses}${quote}`);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (hasFlex && !hasFlexCol) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'flexOnly',\n\t\t\t\t\tdata: { cls: 'flex' },\n\t\t\t\t\tsuggest: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmessageId: 'flexOnly',\n\t\t\t\t\t\t\tdata: { cls: 'flex' },\n\t\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\t\tconst replacedClasses = classes.map((cl) => (cl === 'flex' ? 'flex-row' : cl));\n\t\t\t\t\t\t\t\tconst finalClasses = replacedClasses.join(' ');\n\t\t\t\t\t\t\t\tconst quote = (raw ?? '\"').startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\t\t\treturn fixer.replaceText(node, `${quote}${finalClasses}${quote}`);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (offendingForbidden.length > 0) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'forbidden',\n\t\t\t\t\tdata: { cls: offendingForbidden.join(', ') },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst kept = classes.filter((cl) => !FORBIDDEN.has(cl));\n\t\t\t\t\t\tconst finalClasses = kept.join(' ');\n\t\t\t\t\t\tconst quote = (raw ?? '\"').startsWith(\"'\") ? \"'\" : '\"';\n\t\t\t\t\t\treturn fixer.replaceText(node, `${quote}${finalClasses}${quote}`);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tJSXAttribute(attr) {\n\t\t\t\tif (attr.name.type !== 'JSXIdentifier' || attr.name.name !== 'className') return;\n\n\t\t\t\tif (attr.value?.type === 'Literal' && typeof attr.value.value === 'string') {\n\t\t\t\t\treportAndFix(attr.value, attr.value.value, attr.value.raw);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tattr.value?.type === 'JSXExpressionContainer' &&\n\t\t\t\t\tattr.value.expression.type === 'Literal' &&\n\t\t\t\t\ttypeof attr.value.expression.value === 'string'\n\t\t\t\t)\n\t\t\t\t\treportAndFix(attr.value.expression, attr.value.expression.value, attr.value.expression.raw);\n\t\t\t},\n\t\t};\n\t},\n});\n\nexport default definePlugin({\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-native-tailwind',\n\t},\n\trules: {\n\t\t'class-name-rules': classNameRules,\n\t},\n});\n"],"mappings":"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"}
@@ -1,6 +1,5 @@
1
- import { TSESLint } from "@typescript-eslint/utils";
2
1
  //#region src/plugins/nest.d.ts
3
- declare const plugin: TSESLint.FlatConfig.Plugin;
2
+ declare const _default: import("@oxlint/plugins").Plugin;
4
3
  //#endregion
5
- export { plugin as default };
4
+ export { _default as default };
6
5
  //# sourceMappingURL=nest.d.ts.map
@@ -1,3 +1,5 @@
1
+ import { definePlugin, defineRule } from "@oxlint/plugins";
2
+
1
3
  //#region src/plugins/nest.ts
2
4
  const DEFAULT_LOCALE = "en-US";
3
5
  function isSortable(node) {
@@ -5,7 +7,7 @@ function isSortable(node) {
5
7
  }
6
8
  function nodeName(node) {
7
9
  if (node.type === "Identifier") return node.name;
8
- if (node.type === "CallExpression" && node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier") return node.callee.object.name;
10
+ if (node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier") return node.callee.object.name;
9
11
  return "";
10
12
  }
11
13
  function isFactoryProviderInjectArray(node) {
@@ -15,43 +17,46 @@ function isFactoryProviderInjectArray(node) {
15
17
  if (property.parent.type !== "ObjectExpression") return false;
16
18
  return property.parent.properties.some((item) => item.type === "Property" && item.key.type === "Identifier" && item.key.name === "useFactory");
17
19
  }
18
- const plugin = {
20
+ const sortModuleMetadataArrays = defineRule({
19
21
  meta: {
20
- name: "eslint-plugin-mahir-nest",
21
- version: "1.0.0"
22
+ type: "suggestion",
23
+ docs: { description: "Ensure Module metadata arrays are sorted alphabetically" },
24
+ fixable: "code",
25
+ schema: [{
26
+ type: "object",
27
+ additionalProperties: false,
28
+ properties: { locale: { type: "string" } }
29
+ }],
30
+ messages: { moduleMetadataArraysAreSorted: "`Module` metadata arrays should be sorted in ASC alphabetical order" },
31
+ defaultOptions: [{ locale: DEFAULT_LOCALE }]
22
32
  },
23
- rules: { "sort-module-metadata-arrays": {
24
- meta: {
25
- type: "suggestion",
26
- docs: { description: "Ensure Module metadata arrays are sorted alphabetically" },
27
- fixable: "code",
28
- schema: [{
29
- type: "object",
30
- additionalProperties: false,
31
- properties: { locale: { type: "string" } }
32
- }],
33
- messages: { moduleMetadataArraysAreSorted: "`Module` metadata arrays should be sorted in ASC alphabetical order" }
34
- },
35
- defaultOptions: [{ locale: DEFAULT_LOCALE }],
36
- create(context) {
37
- const locale = context.options.at(0)?.locale ?? DEFAULT_LOCALE;
38
- const sourceCode = context.sourceCode;
39
- return { "ClassDeclaration > Decorator[expression.callee.name=\"Module\"] Property > ArrayExpression"(node) {
33
+ createOnce(context) {
34
+ let locale = DEFAULT_LOCALE;
35
+ return {
36
+ before() {
37
+ locale = context.options[0]?.locale ?? DEFAULT_LOCALE;
38
+ },
39
+ "ClassDeclaration > Decorator[expression.callee.name=\"Module\"] Property > ArrayExpression"(node) {
40
+ if (node.type !== "ArrayExpression") return;
40
41
  if (isFactoryProviderInjectArray(node)) return;
41
42
  const sortable = node.elements.filter(isSortable);
42
43
  const sorted = sortable.toSorted((left, right) => nodeName(left).localeCompare(nodeName(right), locale));
43
44
  if (sortable.every((element, index) => element === sorted[index])) return;
44
- const texts = sorted.map((element) => sourceCode.getText(element));
45
+ const texts = sorted.map((element) => context.sourceCode.getText(element));
45
46
  context.report({
46
47
  node,
47
48
  messageId: "moduleMetadataArraysAreSorted",
48
49
  fix: (fixer) => sortable.map((element, index) => fixer.replaceText(element, texts[index] ?? ""))
49
50
  });
50
- } };
51
- }
52
- } }
53
- };
51
+ }
52
+ };
53
+ }
54
+ });
55
+ var nest_default = definePlugin({
56
+ meta: { name: "eslint-plugin-mahir-nest" },
57
+ rules: { "sort-module-metadata-arrays": sortModuleMetadataArrays }
58
+ });
54
59
 
55
60
  //#endregion
56
- export { plugin as default };
61
+ export { nest_default as default };
57
62
  //# sourceMappingURL=nest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nest.js","names":[],"sources":["../../src/plugins/nest.ts"],"sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\n\nconst DEFAULT_LOCALE = 'en-US';\n\ntype Options = [\n\t{\n\t\tlocale?: string;\n\t},\n];\n\nfunction isSortable(\n\tnode: TSESTree.Expression | TSESTree.SpreadElement | null,\n): node is TSESTree.CallExpression | TSESTree.Identifier {\n\treturn node?.type === 'Identifier' || node?.type === 'CallExpression';\n}\n\nfunction nodeName(node: TSESTree.Node) {\n\tif (node.type === 'Identifier') return node.name;\n\tif (\n\t\tnode.type === 'CallExpression' &&\n\t\tnode.callee.type === 'MemberExpression' &&\n\t\tnode.callee.object.type === 'Identifier'\n\t)\n\t\treturn node.callee.object.name;\n\treturn '';\n}\n\nfunction isFactoryProviderInjectArray(node: TSESTree.ArrayExpression) {\n\tif (node.parent.type !== 'Property') return false;\n\tconst property = node.parent;\n\tif (property.key.type !== 'Identifier' || property.key.name !== 'inject') return false;\n\tif (property.parent.type !== 'ObjectExpression') return false;\n\treturn property.parent.properties.some(\n\t\t(item) => item.type === 'Property' && item.key.type === 'Identifier' && item.key.name === 'useFactory',\n\t);\n}\n\nconst sortModuleMetadataArrays: TSESLint.RuleModule<'moduleMetadataArraysAreSorted', Options> = {\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Ensure Module metadata arrays are sorted alphabetically',\n\t\t},\n\t\tfixable: 'code',\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: 'object',\n\t\t\t\tadditionalProperties: false,\n\t\t\t\tproperties: {\n\t\t\t\t\tlocale: { type: 'string' },\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tmessages: {\n\t\t\tmoduleMetadataArraysAreSorted: '`Module` metadata arrays should be sorted in ASC alphabetical order',\n\t\t},\n\t},\n\tdefaultOptions: [{ locale: DEFAULT_LOCALE }],\n\tcreate(context) {\n\t\tconst locale = context.options.at(0)?.locale ?? DEFAULT_LOCALE;\n\t\tconst sourceCode = context.sourceCode;\n\t\treturn {\n\t\t\t'ClassDeclaration > Decorator[expression.callee.name=\"Module\"] Property > ArrayExpression'(\n\t\t\t\tnode: TSESTree.ArrayExpression,\n\t\t\t) {\n\t\t\t\tif (isFactoryProviderInjectArray(node)) return;\n\t\t\t\tconst sortable = node.elements.filter(isSortable);\n\t\t\t\tconst sorted = sortable.toSorted((left, right) => nodeName(left).localeCompare(nodeName(right), locale));\n\t\t\t\tif (sortable.every((element, index) => element === sorted[index])) return;\n\t\t\t\tconst texts = sorted.map((element) => sourceCode.getText(element));\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'moduleMetadataArraysAreSorted',\n\t\t\t\t\tfix: (fixer) => sortable.map((element, index) => fixer.replaceText(element, texts[index] ?? '')),\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nconst plugin: TSESLint.FlatConfig.Plugin = {\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-nest',\n\t\tversion: '1.0.0',\n\t},\n\trules: {\n\t\t'sort-module-metadata-arrays': sortModuleMetadataArrays,\n\t},\n};\n\nexport default plugin;\n"],"mappings":";AAEA,MAAM,iBAAiB;AAQvB,SAAS,WACR,MACwD;CACxD,OAAO,MAAM,SAAS,gBAAgB,MAAM,SAAS;AACtD;AAEA,SAAS,SAAS,MAAqB;CACtC,IAAI,KAAK,SAAS,cAAc,OAAO,KAAK;CAC5C,IACC,KAAK,SAAS,oBACd,KAAK,OAAO,SAAS,sBACrB,KAAK,OAAO,OAAO,SAAS,cAE5B,OAAO,KAAK,OAAO,OAAO;CAC3B,OAAO;AACR;AAEA,SAAS,6BAA6B,MAAgC;CACrE,IAAI,KAAK,OAAO,SAAS,YAAY,OAAO;CAC5C,MAAM,WAAW,KAAK;CACtB,IAAI,SAAS,IAAI,SAAS,gBAAgB,SAAS,IAAI,SAAS,UAAU,OAAO;CACjF,IAAI,SAAS,OAAO,SAAS,oBAAoB,OAAO;CACxD,OAAO,SAAS,OAAO,WAAW,MAChC,SAAS,KAAK,SAAS,cAAc,KAAK,IAAI,SAAS,gBAAgB,KAAK,IAAI,SAAS,YAC3F;AACD;AA6CA,MAAM,SAAqC;CAC1C,MAAM;EACL,MAAM;EACN,SAAS;CACV;CACA,OAAO,EACN,+BAA+B;EAhDhC,MAAM;GACL,MAAM;GACN,MAAM,EACL,aAAa,0DACd;GACA,SAAS;GACT,QAAQ,CACP;IACC,MAAM;IACN,sBAAsB;IACtB,YAAY,EACX,QAAQ,EAAE,MAAM,SAAS,EAC1B;GACD,CACD;GACA,UAAU,EACT,+BAA+B,sEAChC;EACD;EACA,gBAAgB,CAAC,EAAE,QAAQ,eAAe,CAAC;EAC3C,OAAO,SAAS;GACf,MAAM,SAAS,QAAQ,QAAQ,GAAG,CAAC,CAAC,EAAE,UAAU;GAChD,MAAM,aAAa,QAAQ;GAC3B,OAAO,EACN,6FACC,MACC;IACD,IAAI,6BAA6B,IAAI,GAAG;IACxC,MAAM,WAAW,KAAK,SAAS,OAAO,UAAU;IAChD,MAAM,SAAS,SAAS,UAAU,MAAM,UAAU,SAAS,IAAI,CAAC,CAAC,cAAc,SAAS,KAAK,GAAG,MAAM,CAAC;IACvG,IAAI,SAAS,OAAO,SAAS,UAAU,YAAY,OAAO,MAAM,GAAG;IACnE,MAAM,QAAQ,OAAO,KAAK,YAAY,WAAW,QAAQ,OAAO,CAAC;IACjE,QAAQ,OAAO;KACd;KACA,WAAW;KACX,MAAM,UAAU,SAAS,KAAK,SAAS,UAAU,MAAM,YAAY,SAAS,MAAM,UAAU,EAAE,CAAC;IAChG,CAAC;GACF,EACD;EACD;CASuD,EACvD;AACD"}
1
+ {"version":3,"file":"nest.js","names":[],"sources":["../../src/plugins/nest.ts"],"sourcesContent":["import { definePlugin, defineRule } from '@oxlint/plugins';\n\nimport type { ESTree } from '@oxlint/plugins';\n\nconst DEFAULT_LOCALE = 'en-US';\n\nfunction isSortable(node: ESTree.ArrayExpressionElement): node is ESTree.CallExpression | ESTree.IdentifierName | ESTree.IdentifierReference {\n\treturn node?.type === 'Identifier' || node?.type === 'CallExpression';\n}\n\nfunction nodeName(node: ESTree.CallExpression | ESTree.IdentifierName | ESTree.IdentifierReference) {\n\tif (node.type === 'Identifier') return node.name;\n\tif (node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier') return node.callee.object.name;\n\treturn '';\n}\n\nfunction isFactoryProviderInjectArray(node: ESTree.ArrayExpression) {\n\tif (node.parent.type !== 'Property') return false;\n\tconst property = node.parent;\n\tif (property.key.type !== 'Identifier' || property.key.name !== 'inject') return false;\n\tif (property.parent.type !== 'ObjectExpression') return false;\n\treturn property.parent.properties.some(\n\t\t(item) => item.type === 'Property' && item.key.type === 'Identifier' && item.key.name === 'useFactory',\n\t);\n}\n\nconst sortModuleMetadataArrays = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Ensure Module metadata arrays are sorted alphabetically',\n\t\t},\n\t\tfixable: 'code',\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: 'object',\n\t\t\t\tadditionalProperties: false,\n\t\t\t\tproperties: {\n\t\t\t\t\tlocale: { type: 'string' },\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tmessages: {\n\t\t\tmoduleMetadataArraysAreSorted: '`Module` metadata arrays should be sorted in ASC alphabetical order',\n\t\t},\n\t\tdefaultOptions: [{ locale: DEFAULT_LOCALE }],\n\t},\n\tcreateOnce(context) {\n\t\tlet locale = DEFAULT_LOCALE;\n\t\treturn {\n\t\t\tbefore() {\n\t\t\t\tconst options = context.options[0] as { locale?: string } | undefined;\n\t\t\t\tlocale = options?.locale ?? DEFAULT_LOCALE;\n\t\t\t},\n\t\t\t'ClassDeclaration > Decorator[expression.callee.name=\"Module\"] Property > ArrayExpression'(node) {\n\t\t\t\tif (node.type !== 'ArrayExpression') return;\n\t\t\t\tif (isFactoryProviderInjectArray(node)) return;\n\t\t\t\tconst sortable = node.elements.filter(isSortable);\n\t\t\t\tconst sorted = sortable.toSorted((left, right) => nodeName(left).localeCompare(nodeName(right), locale));\n\t\t\t\tif (sortable.every((element, index) => element === sorted[index])) return;\n\t\t\t\tconst texts = sorted.map((element) => context.sourceCode.getText(element));\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'moduleMetadataArraysAreSorted',\n\t\t\t\t\tfix: (fixer) => sortable.map((element, index) => fixer.replaceText(element, texts[index] ?? '')),\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n});\n\nexport default definePlugin({\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-nest',\n\t},\n\trules: {\n\t\t'sort-module-metadata-arrays': sortModuleMetadataArrays,\n\t},\n});\n"],"mappings":";;;AAIA,MAAM,iBAAiB;AAEvB,SAAS,WAAW,MAAyH;CAC5I,OAAO,MAAM,SAAS,gBAAgB,MAAM,SAAS;AACtD;AAEA,SAAS,SAAS,MAAkF;CACnG,IAAI,KAAK,SAAS,cAAc,OAAO,KAAK;CAC5C,IAAI,KAAK,OAAO,SAAS,sBAAsB,KAAK,OAAO,OAAO,SAAS,cAAc,OAAO,KAAK,OAAO,OAAO;CACnH,OAAO;AACR;AAEA,SAAS,6BAA6B,MAA8B;CACnE,IAAI,KAAK,OAAO,SAAS,YAAY,OAAO;CAC5C,MAAM,WAAW,KAAK;CACtB,IAAI,SAAS,IAAI,SAAS,gBAAgB,SAAS,IAAI,SAAS,UAAU,OAAO;CACjF,IAAI,SAAS,OAAO,SAAS,oBAAoB,OAAO;CACxD,OAAO,SAAS,OAAO,WAAW,MAChC,SAAS,KAAK,SAAS,cAAc,KAAK,IAAI,SAAS,gBAAgB,KAAK,IAAI,SAAS,YAC3F;AACD;AAEA,MAAM,2BAA2B,WAAW;CAC3C,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,0DACd;EACA,SAAS;EACT,QAAQ,CACP;GACC,MAAM;GACN,sBAAsB;GACtB,YAAY,EACX,QAAQ,EAAE,MAAM,SAAS,EAC1B;EACD,CACD;EACA,UAAU,EACT,+BAA+B,sEAChC;EACA,gBAAgB,CAAC,EAAE,QAAQ,eAAe,CAAC;CAC5C;CACA,WAAW,SAAS;EACnB,IAAI,SAAS;EACb,OAAO;GACN,SAAS;IAER,SADgB,QAAQ,QAAQ,EAChB,EAAE,UAAU;GAC7B;GACA,6FAA2F,MAAM;IAChG,IAAI,KAAK,SAAS,mBAAmB;IACrC,IAAI,6BAA6B,IAAI,GAAG;IACxC,MAAM,WAAW,KAAK,SAAS,OAAO,UAAU;IAChD,MAAM,SAAS,SAAS,UAAU,MAAM,UAAU,SAAS,IAAI,CAAC,CAAC,cAAc,SAAS,KAAK,GAAG,MAAM,CAAC;IACvG,IAAI,SAAS,OAAO,SAAS,UAAU,YAAY,OAAO,MAAM,GAAG;IACnE,MAAM,QAAQ,OAAO,KAAK,YAAY,QAAQ,WAAW,QAAQ,OAAO,CAAC;IACzE,QAAQ,OAAO;KACd;KACA,WAAW;KACX,MAAM,UAAU,SAAS,KAAK,SAAS,UAAU,MAAM,YAAY,SAAS,MAAM,UAAU,EAAE,CAAC;IAChG,CAAC;GACF;EACD;CACD;AACD,CAAC;AAED,mBAAe,aAAa;CAC3B,MAAM,EACL,MAAM,2BACP;CACA,OAAO,EACN,+BAA+B,yBAChC;AACD,CAAC"}
@@ -1,6 +1,5 @@
1
- import { TSESLint } from "@typescript-eslint/utils";
2
1
  //#region src/plugins/restricted-syntax.d.ts
3
- declare const plugin: TSESLint.FlatConfig.Plugin;
2
+ declare const _default: import("@oxlint/plugins").Plugin;
4
3
  //#endregion
5
- export { plugin as default };
4
+ export { _default as default };
6
5
  //# sourceMappingURL=restricted-syntax.d.ts.map