@imranbarbhuiya/oxc-config 0.1.11 → 0.1.13

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.
package/dist/common.js CHANGED
@@ -13,7 +13,7 @@ const config = defineConfig({
13
13
  "block-scoped-var": 2,
14
14
  "consistent-return": 2,
15
15
  "constructor-super": 2,
16
- curly: [2, "multi-or-nest"],
16
+ curly: [2, "multi-line"],
17
17
  "default-case": 2,
18
18
  "default-case-last": 2,
19
19
  "default-param-last": 2,
@@ -168,7 +168,7 @@ const config = defineConfig({
168
168
  "unicorn/new-for-builtins": 2,
169
169
  "unicorn/no-abusive-eslint-disable": 2,
170
170
  "unicorn/no-array-for-each": 1,
171
- "unicorn/no-array-method-this-argument": 2,
171
+ "unicorn/no-array-method-this-argument": 0,
172
172
  "unicorn/no-await-in-promise-methods": 2,
173
173
  "unicorn/no-document-cookie": 2,
174
174
  "unicorn/no-empty-file": 2,
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","names":[],"sources":["../src/common.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { localPlugin, nativePlugins } from './config.js';\n\nimport type { OxlintConfig } from 'oxlint';\n\nconst rules: NonNullable<OxlintConfig['rules']> = {\n\t'array-callback-return': 2,\n\t'arrow-body-style': [2, 'as-needed'],\n\t'block-scoped-var': 2,\n\t'consistent-return': 2,\n\t'constructor-super': 2,\n\tcurly: [2, 'multi-or-nest'],\n\t'default-case': 2,\n\t'default-case-last': 2,\n\t'default-param-last': 2,\n\t'dot-notation': 2,\n\teqeqeq: 2,\n\t'for-direction': 2,\n\t'func-name-matching': 2,\n\t'func-names': [2, 'as-needed'],\n\t'func-style': [\n\t\t2,\n\t\t'declaration',\n\t\t{\n\t\t\tallowArrowFunctions: true,\n\t\t},\n\t],\n\t'getter-return': 2,\n\t'grouped-accessor-pairs': [2, 'getBeforeSet'],\n\t'guard-for-in': 2,\n\t'import/export': 2,\n\t'import/first': 2,\n\t'import/newline-after-import': 2,\n\t'import/no-absolute-path': 2,\n\t'import/no-amd': 2,\n\t'import/no-duplicates': 2,\n\t'import/no-dynamic-require': 2,\n\t'import/no-mutable-exports': 2,\n\t'import/no-self-import': 2,\n\t'import/no-webpack-loader-syntax': 2,\n\t'no-alert': 2,\n\t'no-array-constructor': 2,\n\t'no-async-promise-executor': 2,\n\t'no-caller': 2,\n\t'no-case-declarations': 2,\n\t'no-class-assign': 2,\n\t'no-compare-neg-zero': 2,\n\t'no-cond-assign': 2,\n\t'no-const-assign': 2,\n\t'no-constructor-return': 2,\n\t'no-control-regex': 2,\n\t'no-debugger': 2,\n\t'no-delete-var': 2,\n\t'no-dupe-class-members': 2,\n\t'no-dupe-else-if': 2,\n\t'no-dupe-keys': 2,\n\t'no-duplicate-case': 2,\n\t'no-empty-character-class': 2,\n\t'no-empty-pattern': 2,\n\t'no-eval': 2,\n\t'no-ex-assign': 2,\n\t'no-extend-native': 2,\n\t'no-extra-bind': 2,\n\t'no-extra-boolean-cast': 2,\n\t'no-extra-label': 2,\n\t'no-fallthrough': 2,\n\t'no-func-assign': 2,\n\t'no-global-assign': 2,\n\t'no-implicit-coercion': 2,\n\t'no-implicit-globals': 2,\n\t'no-implied-eval': 2,\n\t'no-import-assign': 2,\n\t'no-inner-declarations': 2,\n\t'no-invalid-regexp': 2,\n\t'no-irregular-whitespace': 2,\n\t'no-iterator': 2,\n\t'no-label-var': 2,\n\t'no-labels': 2,\n\t'no-lone-blocks': 2,\n\t'no-lonely-if': 2,\n\t'no-loss-of-precision': 2,\n\t'no-misleading-character-class': 2,\n\t'no-multi-assign': 2,\n\t'no-multi-str': 2,\n\t'no-new-func': 2,\n\t'no-new-wrappers': 2,\n\t'no-nonoctal-decimal-escape': 2,\n\t'no-obj-calls': 2,\n\t'no-promise-executor-return': 2,\n\t'no-proto': 2,\n\t'no-prototype-builtins': 2,\n\t'no-redeclare': [\n\t\t2,\n\t\t{\n\t\t\tbuiltinGlobals: true,\n\t\t},\n\t],\n\t'no-regex-spaces': 2,\n\t'no-return-assign': 2,\n\t'no-script-url': 2,\n\t'no-self-assign': 2,\n\t'no-self-compare': 2,\n\t'no-sequences': 2,\n\t'no-setter-return': 2,\n\t'no-shadow': [\n\t\t2,\n\t\t{\n\t\t\tbuiltinGlobals: false,\n\t\t\thoist: 'all',\n\t\t},\n\t],\n\t'no-shadow-restricted-names': 2,\n\t'no-template-curly-in-string': 2,\n\t'no-this-before-super': 2,\n\t'no-throw-literal': 2,\n\t'no-undef': 2,\n\t'no-unexpected-multiline': 2,\n\t'no-unmodified-loop-condition': 2,\n\t'no-unneeded-ternary': 2,\n\t'no-unreachable-loop': 2,\n\t'no-unsafe-finally': 2,\n\t'no-unsafe-negation': 2,\n\t'no-unsafe-optional-chaining': 2,\n\t'no-unused-expressions': 2,\n\t'no-unused-labels': 2,\n\t'no-unused-vars': 2,\n\t'no-use-before-define': [\n\t\t2,\n\t\t{\n\t\t\tclasses: true,\n\t\t\tfunctions: false,\n\t\t\tvariables: true,\n\t\t},\n\t],\n\t'no-useless-backreference': 2,\n\t'no-useless-call': 2,\n\t'no-useless-catch': 2,\n\t'no-useless-computed-key': 2,\n\t'no-useless-concat': 2,\n\t'no-useless-constructor': 2,\n\t'no-useless-escape': 2,\n\t'no-useless-rename': [\n\t\t2,\n\t\t{\n\t\t\tignoreDestructuring: false,\n\t\t\tignoreExport: false,\n\t\t\tignoreImport: false,\n\t\t},\n\t],\n\t'no-useless-return': 2,\n\t'no-var': 2,\n\t'no-with': 2,\n\t'object-shorthand': [2, 'always'],\n\t'one-var': [2, 'never'],\n\t'operator-assignment': [2, 'always'],\n\t'prefer-arrow-callback': 2,\n\t'prefer-const': 2,\n\t'prefer-exponentiation-operator': 2,\n\t'prefer-numeric-literals': 2,\n\t'prefer-object-has-own': 2,\n\t'prefer-object-spread': 2,\n\t'prefer-promise-reject-errors': 2,\n\t'prefer-regex-literals': [\n\t\t2,\n\t\t{\n\t\t\tdisallowRedundantWrapping: true,\n\t\t},\n\t],\n\t'prefer-rest-params': 2,\n\t'prefer-spread': 2,\n\t'promise/param-names': 2,\n\t'promise/prefer-await-to-callbacks': 1,\n\t'promise/prefer-await-to-then': 2,\n\t'promise/valid-params': 2,\n\tradix: 2,\n\t'require-yield': 2,\n\t'sort-vars': 2,\n\t'symbol-description': 2,\n\t'unicode-bom': [2, 'never'],\n\t'unicorn/catch-error-name': [\n\t\t2,\n\t\t{\n\t\t\tname: 'error',\n\t\t},\n\t],\n\t'unicorn/consistent-function-scoping': 2,\n\t'unicorn/empty-brace-spaces': 2,\n\t'unicorn/error-message': 2,\n\t'unicorn/escape-case': 2,\n\t'unicorn/new-for-builtins': 2,\n\t'unicorn/no-abusive-eslint-disable': 2,\n\t'unicorn/no-array-for-each': 1,\n\t'unicorn/no-array-method-this-argument': 2,\n\t'unicorn/no-await-in-promise-methods': 2,\n\t'unicorn/no-document-cookie': 2,\n\t'unicorn/no-empty-file': 2,\n\t'unicorn/no-instanceof-array': 2,\n\t'unicorn/no-invalid-remove-event-listener': 2,\n\t'unicorn/no-lonely-if': 2,\n\t'unicorn/no-negated-condition': 2,\n\t'unicorn/no-new-array': 2,\n\t'unicorn/no-new-buffer': 2,\n\t'unicorn/no-object-as-default-parameter': 2,\n\t'unicorn/no-single-promise-in-promise-methods': 2,\n\t'unicorn/no-static-only-class': 2,\n\t'unicorn/no-thenable': 2,\n\t'unicorn/no-this-assignment': 2,\n\t'unicorn/no-typeof-undefined': 2,\n\t'unicorn/no-unnecessary-await': 2,\n\t'unicorn/no-unreadable-iife': 2,\n\t'unicorn/no-useless-fallback-in-spread': 2,\n\t'unicorn/no-useless-length-check': 2,\n\t'unicorn/no-useless-promise-resolve-reject': 2,\n\t'unicorn/no-useless-spread': 2,\n\t'unicorn/no-useless-switch-case': 2,\n\t'unicorn/no-zero-fractions': 2,\n\t'unicorn/numeric-separators-style': [\n\t\t2,\n\t\t{\n\t\t\tbinary: {\n\t\t\t\tonlyIfContainsSeparator: true,\n\t\t\t},\n\t\t\thexadecimal: {\n\t\t\t\tonlyIfContainsSeparator: true,\n\t\t\t},\n\t\t\tnumber: {\n\t\t\t\tgroupLength: 3,\n\t\t\t\tminimumDigits: 0,\n\t\t\t},\n\t\t\toctal: {\n\t\t\t\tonlyIfContainsSeparator: true,\n\t\t\t},\n\t\t},\n\t],\n\t'unicorn/prefer-array-find': 2,\n\t'unicorn/prefer-array-flat': 2,\n\t'unicorn/prefer-array-flat-map': 2,\n\t'unicorn/prefer-array-index-of': 2,\n\t'unicorn/prefer-array-some': 2,\n\t'unicorn/prefer-code-point': 2,\n\t'unicorn/prefer-date-now': 2,\n\t'unicorn/prefer-default-parameters': 2,\n\t'unicorn/prefer-export-from': 2,\n\t'unicorn/prefer-includes': 2,\n\t'unicorn/prefer-math-trunc': 2,\n\t'unicorn/prefer-modern-math-apis': 2,\n\t'unicorn/prefer-native-coercion-functions': 2,\n\t'unicorn/prefer-number-properties': 2,\n\t'unicorn/prefer-object-from-entries': 2,\n\t'unicorn/prefer-optional-catch-binding': 2,\n\t'unicorn/prefer-query-selector': 2,\n\t'unicorn/prefer-reflect-apply': 2,\n\t'unicorn/prefer-regexp-test': 2,\n\t'unicorn/prefer-set-size': 2,\n\t'unicorn/prefer-string-replace-all': 2,\n\t'unicorn/prefer-string-slice': 2,\n\t'unicorn/prefer-string-starts-ends-with': 2,\n\t'unicorn/prefer-string-trim-start-end': 2,\n\t'unicorn/prefer-type-error': 2,\n\t'unicorn/relative-url-style': [2, 'never'],\n\t'unicorn/require-array-join-separator': 2,\n\t'unicorn/require-number-to-fixed-digits-argument': 2,\n\t'unicorn/require-post-message-target-origin': 2,\n\t'unicorn/text-encoding-identifier-case': 2,\n\t'unicorn/throw-new-error': 2,\n\t'use-isnan': 2,\n\t'valid-typeof': [\n\t\t2,\n\t\t{\n\t\t\trequireStringLiterals: true,\n\t\t},\n\t],\n\t'vars-on-top': 2,\n\tyoda: [2, 'never'],\n};\n\nconst config = defineConfig({\n\tplugins: nativePlugins,\n\tjsPlugins: [localPlugin('mahir-restricted-syntax', './plugins/restricted-syntax.js')],\n\tcategories: {\n\t\tcorrectness: 'off',\n\t},\n\toptions: {\n\t\treportUnusedDisableDirectives: 'warn',\n\t},\n\trules,\n});\n\nexport default config;\n"],"mappings":";;;;AAqRA,MAAM,SAAS,aAAa;CAC3B,SAAS;CACT,WAAW,CAAC,YAAY,2BAA2B,gCAAgC,CAAC;CACpF,YAAY,EACX,aAAa,MACd;CACA,SAAS,EACR,+BAA+B,OAChC;CACA;EAvRA,yBAAyB;EACzB,oBAAoB,CAAC,GAAG,WAAW;EACnC,oBAAoB;EACpB,qBAAqB;EACrB,qBAAqB;EACrB,OAAO,CAAC,GAAG,eAAe;EAC1B,gBAAgB;EAChB,qBAAqB;EACrB,sBAAsB;EACtB,gBAAgB;EAChB,QAAQ;EACR,iBAAiB;EACjB,sBAAsB;EACtB,cAAc,CAAC,GAAG,WAAW;EAC7B,cAAc;GACb;GACA;GACA,EACC,qBAAqB,KACtB;EACD;EACA,iBAAiB;EACjB,0BAA0B,CAAC,GAAG,cAAc;EAC5C,gBAAgB;EAChB,iBAAiB;EACjB,gBAAgB;EAChB,+BAA+B;EAC/B,2BAA2B;EAC3B,iBAAiB;EACjB,wBAAwB;EACxB,6BAA6B;EAC7B,6BAA6B;EAC7B,yBAAyB;EACzB,mCAAmC;EACnC,YAAY;EACZ,wBAAwB;EACxB,6BAA6B;EAC7B,aAAa;EACb,wBAAwB;EACxB,mBAAmB;EACnB,uBAAuB;EACvB,kBAAkB;EAClB,mBAAmB;EACnB,yBAAyB;EACzB,oBAAoB;EACpB,eAAe;EACf,iBAAiB;EACjB,yBAAyB;EACzB,mBAAmB;EACnB,gBAAgB;EAChB,qBAAqB;EACrB,4BAA4B;EAC5B,oBAAoB;EACpB,WAAW;EACX,gBAAgB;EAChB,oBAAoB;EACpB,iBAAiB;EACjB,yBAAyB;EACzB,kBAAkB;EAClB,kBAAkB;EAClB,kBAAkB;EAClB,oBAAoB;EACpB,wBAAw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AAwC;EACxC,6BAA6B;EAC7B,8BAA8B,CAAC,GAAG,OAAO;EACzC,wCAAwC;EACxC,mDAAmD;EACnD,8CAA8C;EAC9C,yCAAyC;EACzC,2BAA2B;EAC3B,aAAa;EACb,gBAAgB,CACf,GACA,EACC,uBAAuB,KACxB,CACD;EACA,eAAe;EACf,MAAM,CAAC,GAAG,OAAO;CAYb;AACL,CAAC"}
1
+ {"version":3,"file":"common.js","names":[],"sources":["../src/common.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { localPlugin, nativePlugins } from './config.js';\n\nimport type { OxlintConfig } from 'oxlint';\n\nconst rules: NonNullable<OxlintConfig['rules']> = {\n\t'array-callback-return': 2,\n\t'arrow-body-style': [2, 'as-needed'],\n\t'block-scoped-var': 2,\n\t'consistent-return': 2,\n\t'constructor-super': 2,\n\t// `multi-line` is the only option that leaves line breaking to oxfmt. Under `multi-or-nest` a\n\t// single statement longer than `printWidth` gets wrapped in braces by the formatter, and the\n\t// linter then asks for those braces back, so the two never agree. This still catches what the\n\t// rule is for, a body sitting on its own line without braces.\n\tcurly: [2, 'multi-line'],\n\t'default-case': 2,\n\t'default-case-last': 2,\n\t'default-param-last': 2,\n\t'dot-notation': 2,\n\teqeqeq: 2,\n\t'for-direction': 2,\n\t'func-name-matching': 2,\n\t'func-names': [2, 'as-needed'],\n\t'func-style': [\n\t\t2,\n\t\t'declaration',\n\t\t{\n\t\t\tallowArrowFunctions: true,\n\t\t},\n\t],\n\t'getter-return': 2,\n\t'grouped-accessor-pairs': [2, 'getBeforeSet'],\n\t'guard-for-in': 2,\n\t'import/export': 2,\n\t'import/first': 2,\n\t'import/newline-after-import': 2,\n\t'import/no-absolute-path': 2,\n\t'import/no-amd': 2,\n\t'import/no-duplicates': 2,\n\t'import/no-dynamic-require': 2,\n\t'import/no-mutable-exports': 2,\n\t'import/no-self-import': 2,\n\t'import/no-webpack-loader-syntax': 2,\n\t'no-alert': 2,\n\t'no-array-constructor': 2,\n\t'no-async-promise-executor': 2,\n\t'no-caller': 2,\n\t'no-case-declarations': 2,\n\t'no-class-assign': 2,\n\t'no-compare-neg-zero': 2,\n\t'no-cond-assign': 2,\n\t'no-const-assign': 2,\n\t'no-constructor-return': 2,\n\t'no-control-regex': 2,\n\t'no-debugger': 2,\n\t'no-delete-var': 2,\n\t'no-dupe-class-members': 2,\n\t'no-dupe-else-if': 2,\n\t'no-dupe-keys': 2,\n\t'no-duplicate-case': 2,\n\t'no-empty-character-class': 2,\n\t'no-empty-pattern': 2,\n\t'no-eval': 2,\n\t'no-ex-assign': 2,\n\t'no-extend-native': 2,\n\t'no-extra-bind': 2,\n\t'no-extra-boolean-cast': 2,\n\t'no-extra-label': 2,\n\t'no-fallthrough': 2,\n\t'no-func-assign': 2,\n\t'no-global-assign': 2,\n\t'no-implicit-coercion': 2,\n\t'no-implicit-globals': 2,\n\t'no-implied-eval': 2,\n\t'no-import-assign': 2,\n\t'no-inner-declarations': 2,\n\t'no-invalid-regexp': 2,\n\t'no-irregular-whitespace': 2,\n\t'no-iterator': 2,\n\t'no-label-var': 2,\n\t'no-labels': 2,\n\t'no-lone-blocks': 2,\n\t'no-lonely-if': 2,\n\t'no-loss-of-precision': 2,\n\t'no-misleading-character-class': 2,\n\t'no-multi-assign': 2,\n\t'no-multi-str': 2,\n\t'no-new-func': 2,\n\t'no-new-wrappers': 2,\n\t'no-nonoctal-decimal-escape': 2,\n\t'no-obj-calls': 2,\n\t'no-promise-executor-return': 2,\n\t'no-proto': 2,\n\t'no-prototype-builtins': 2,\n\t'no-redeclare': [\n\t\t2,\n\t\t{\n\t\t\tbuiltinGlobals: true,\n\t\t},\n\t],\n\t'no-regex-spaces': 2,\n\t'no-return-assign': 2,\n\t'no-script-url': 2,\n\t'no-self-assign': 2,\n\t'no-self-compare': 2,\n\t'no-sequences': 2,\n\t'no-setter-return': 2,\n\t'no-shadow': [\n\t\t2,\n\t\t{\n\t\t\tbuiltinGlobals: false,\n\t\t\thoist: 'all',\n\t\t},\n\t],\n\t'no-shadow-restricted-names': 2,\n\t'no-template-curly-in-string': 2,\n\t'no-this-before-super': 2,\n\t'no-throw-literal': 2,\n\t'no-undef': 2,\n\t'no-unexpected-multiline': 2,\n\t'no-unmodified-loop-condition': 2,\n\t'no-unneeded-ternary': 2,\n\t'no-unreachable-loop': 2,\n\t'no-unsafe-finally': 2,\n\t'no-unsafe-negation': 2,\n\t'no-unsafe-optional-chaining': 2,\n\t'no-unused-expressions': 2,\n\t'no-unused-labels': 2,\n\t'no-unused-vars': 2,\n\t'no-use-before-define': [\n\t\t2,\n\t\t{\n\t\t\tclasses: true,\n\t\t\tfunctions: false,\n\t\t\tvariables: true,\n\t\t},\n\t],\n\t'no-useless-backreference': 2,\n\t'no-useless-call': 2,\n\t'no-useless-catch': 2,\n\t'no-useless-computed-key': 2,\n\t'no-useless-concat': 2,\n\t'no-useless-constructor': 2,\n\t'no-useless-escape': 2,\n\t'no-useless-rename': [\n\t\t2,\n\t\t{\n\t\t\tignoreDestructuring: false,\n\t\t\tignoreExport: false,\n\t\t\tignoreImport: false,\n\t\t},\n\t],\n\t'no-useless-return': 2,\n\t'no-var': 2,\n\t'no-with': 2,\n\t'object-shorthand': [2, 'always'],\n\t'one-var': [2, 'never'],\n\t'operator-assignment': [2, 'always'],\n\t'prefer-arrow-callback': 2,\n\t'prefer-const': 2,\n\t'prefer-exponentiation-operator': 2,\n\t'prefer-numeric-literals': 2,\n\t'prefer-object-has-own': 2,\n\t'prefer-object-spread': 2,\n\t'prefer-promise-reject-errors': 2,\n\t'prefer-regex-literals': [\n\t\t2,\n\t\t{\n\t\t\tdisallowRedundantWrapping: true,\n\t\t},\n\t],\n\t'prefer-rest-params': 2,\n\t'prefer-spread': 2,\n\t'promise/param-names': 2,\n\t'promise/prefer-await-to-callbacks': 1,\n\t'promise/prefer-await-to-then': 2,\n\t'promise/valid-params': 2,\n\tradix: 2,\n\t'require-yield': 2,\n\t'sort-vars': 2,\n\t'symbol-description': 2,\n\t'unicode-bom': [2, 'never'],\n\t'unicorn/catch-error-name': [\n\t\t2,\n\t\t{\n\t\t\tname: 'error',\n\t\t},\n\t],\n\t'unicorn/consistent-function-scoping': 2,\n\t'unicorn/empty-brace-spaces': 2,\n\t'unicorn/error-message': 2,\n\t'unicorn/escape-case': 2,\n\t'unicorn/new-for-builtins': 2,\n\t'unicorn/no-abusive-eslint-disable': 2,\n\t'unicorn/no-array-for-each': 1,\n\t'unicorn/no-array-method-this-argument': 0,\n\t'unicorn/no-await-in-promise-methods': 2,\n\t'unicorn/no-document-cookie': 2,\n\t'unicorn/no-empty-file': 2,\n\t'unicorn/no-instanceof-array': 2,\n\t'unicorn/no-invalid-remove-event-listener': 2,\n\t'unicorn/no-lonely-if': 2,\n\t'unicorn/no-negated-condition': 2,\n\t'unicorn/no-new-array': 2,\n\t'unicorn/no-new-buffer': 2,\n\t'unicorn/no-object-as-default-parameter': 2,\n\t'unicorn/no-single-promise-in-promise-methods': 2,\n\t'unicorn/no-static-only-class': 2,\n\t'unicorn/no-thenable': 2,\n\t'unicorn/no-this-assignment': 2,\n\t'unicorn/no-typeof-undefined': 2,\n\t'unicorn/no-unnecessary-await': 2,\n\t'unicorn/no-unreadable-iife': 2,\n\t'unicorn/no-useless-fallback-in-spread': 2,\n\t'unicorn/no-useless-length-check': 2,\n\t'unicorn/no-useless-promise-resolve-reject': 2,\n\t'unicorn/no-useless-spread': 2,\n\t'unicorn/no-useless-switch-case': 2,\n\t'unicorn/no-zero-fractions': 2,\n\t'unicorn/numeric-separators-style': [\n\t\t2,\n\t\t{\n\t\t\tbinary: {\n\t\t\t\tonlyIfContainsSeparator: true,\n\t\t\t},\n\t\t\thexadecimal: {\n\t\t\t\tonlyIfContainsSeparator: true,\n\t\t\t},\n\t\t\tnumber: {\n\t\t\t\tgroupLength: 3,\n\t\t\t\tminimumDigits: 0,\n\t\t\t},\n\t\t\toctal: {\n\t\t\t\tonlyIfContainsSeparator: true,\n\t\t\t},\n\t\t},\n\t],\n\t'unicorn/prefer-array-find': 2,\n\t'unicorn/prefer-array-flat': 2,\n\t'unicorn/prefer-array-flat-map': 2,\n\t'unicorn/prefer-array-index-of': 2,\n\t'unicorn/prefer-array-some': 2,\n\t'unicorn/prefer-code-point': 2,\n\t'unicorn/prefer-date-now': 2,\n\t'unicorn/prefer-default-parameters': 2,\n\t'unicorn/prefer-export-from': 2,\n\t'unicorn/prefer-includes': 2,\n\t'unicorn/prefer-math-trunc': 2,\n\t'unicorn/prefer-modern-math-apis': 2,\n\t'unicorn/prefer-native-coercion-functions': 2,\n\t'unicorn/prefer-number-properties': 2,\n\t'unicorn/prefer-object-from-entries': 2,\n\t'unicorn/prefer-optional-catch-binding': 2,\n\t'unicorn/prefer-query-selector': 2,\n\t'unicorn/prefer-reflect-apply': 2,\n\t'unicorn/prefer-regexp-test': 2,\n\t'unicorn/prefer-set-size': 2,\n\t'unicorn/prefer-string-replace-all': 2,\n\t'unicorn/prefer-string-slice': 2,\n\t'unicorn/prefer-string-starts-ends-with': 2,\n\t'unicorn/prefer-string-trim-start-end': 2,\n\t'unicorn/prefer-type-error': 2,\n\t'unicorn/relative-url-style': [2, 'never'],\n\t'unicorn/require-array-join-separator': 2,\n\t'unicorn/require-number-to-fixed-digits-argument': 2,\n\t'unicorn/require-post-message-target-origin': 2,\n\t'unicorn/text-encoding-identifier-case': 2,\n\t'unicorn/throw-new-error': 2,\n\t'use-isnan': 2,\n\t'valid-typeof': [\n\t\t2,\n\t\t{\n\t\t\trequireStringLiterals: true,\n\t\t},\n\t],\n\t'vars-on-top': 2,\n\tyoda: [2, 'never'],\n};\n\nconst config = defineConfig({\n\tplugins: nativePlugins,\n\tjsPlugins: [localPlugin('mahir-restricted-syntax', './plugins/restricted-syntax.js')],\n\tcategories: {\n\t\tcorrectness: 'off',\n\t},\n\toptions: {\n\t\treportUnusedDisableDirectives: 'warn',\n\t},\n\trules,\n});\n\nexport default config;\n"],"mappings":";;;;AAyRA,MAAM,SAAS,aAAa;CAC3B,SAAS;CACT,WA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AC,GAAG,OAAO;CAYb;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"api-error.js","names":[],"sources":["../../src/plugins/api-error.ts"],"sourcesContent":["import { definePlugin, defineRule } from '@oxlint/plugins';\n\nimport type { ESTree } from '@oxlint/plugins';\n\nconst DEFAULT_ALLOWED_ERRORS = ['ApiError', 'FormValidationError'];\n\nfunction getStaticFactoryCallee(arg: ESTree.Node) {\n\tif (arg.type !== 'CallExpression') return undefined;\n\tconst { callee } = arg;\n\tif (callee.type !== 'MemberExpression' || callee.computed) return undefined;\n\tconst { object, property } = callee;\n\tif (object.type !== 'Identifier' || property.type !== 'Identifier') return undefined;\n\treturn { callee, name: object.name };\n}\n\nfunction isAstNode(value: unknown): value is ESTree.Node {\n\treturn typeof value === 'object' && value !== null && 'type' in value && typeof (value as { type: unknown }).type === 'string';\n}\n\nconst requireApiError = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t'Require an allowed API error instead of Error inside queryFn/mutationFn so status codes propagate to QueryCache error handling',\n\t\t},\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\tallowedErrors: {\n\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\titems: { type: 'string', minLength: 1 },\n\t\t\t\t\t\tminItems: 1,\n\t\t\t\t\t\tuniqueItems: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tmessages: {\n\t\t\tuseApiError:\n\t\t\t\t'Use `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of `new {{thrown}}(...)` inside {{fnType}}. This ensures the HTTP status code is available in QueryCache/retry/error reporting.',\n\t\t\tuseApiErrorCall:\n\t\t\t\t'Use `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of `{{thrown}}(...)` inside {{fnType}}. This ensures the HTTP status code is available in QueryCache/retry/error reporting.',\n\t\t\tuseApiErrorMember:\n\t\t\t\t'Throw `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of re-throwing `{{thrown}}` directly inside {{fnType}}. The client error object may lose its HTTP status code in QueryCache/retry/error reporting.',\n\t\t},\n\t\tdefaultOptions: [{ allowedErrors: [...DEFAULT_ALLOWED_ERRORS] }],\n\t},\n\tcreateOnce(context) {\n\t\tlet allowedErrors = new Set(DEFAULT_ALLOWED_ERRORS);\n\t\tlet allowedExample = DEFAULT_ALLOWED_ERRORS[0];\n\t\tconst fnStack: string[] = [];\n\t\tconst extractedRefs: { name: string; fnType: string }[] = [];\n\t\tconst moduleFns = new Map<string, ESTree.Node>();\n\n\t\tfunction recordModuleFn(name: string | undefined, body: ESTree.Node | null | undefined) {\n\t\t\tif (!name || !body) return;\n\t\t\tif (!moduleFns.has(name)) moduleFns.set(name, body);\n\t\t}\n\n\t\tfunction isAllowedThrow(arg: ESTree.Node) {\n\t\t\tif (arg.type === 'NewExpression' && arg.callee.type === 'Identifier') return allowedErrors.has(arg.callee.name);\n\t\t\tconst factory = getStaticFactoryCallee(arg);\n\t\t\treturn factory !== undefined && allowedErrors.has(factory.name);\n\t\t}\n\n\t\tfunction checkThrowNode(node: ESTree.ThrowStatement, fnType: string) {\n\t\t\tconst arg = node.argument;\n\t\t\tif (isAllowedThrow(arg)) return;\n\n\t\t\tif (arg.type === 'NewExpression' && arg.callee.type === 'Identifier') {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiError',\n\t\t\t\t\tdata: { thrown: arg.callee.name, fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst factory = getStaticFactoryCallee(arg);\n\t\t\tif (factory) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiErrorCall',\n\t\t\t\t\tdata: { thrown: context.sourceCode.getText(factory.callee), fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (arg.type === 'MemberExpression') {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiErrorMember',\n\t\t\t\t\tdata: { thrown: context.sourceCode.getText(arg), fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tfunction walkThrows(node: ESTree.Node | null | undefined, fnType: string, visited = new Set<ESTree.Node>()) {\n\t\t\tif (!node || visited.has(node)) return;\n\t\t\tvisited.add(node);\n\n\t\t\tif (node.type === 'ThrowStatement') {\n\t\t\t\tcheckThrowNode(node, fnType);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tnode.type === 'FunctionDeclaration' ||\n\t\t\t\tnode.type === 'FunctionExpression' ||\n\t\t\t\tnode.type === 'ArrowFunctionExpression'\n\t\t\t) {\n\t\t\t\twalkThrows(node.body, fnType, visited);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (const key of Object.keys(node)) {\n\t\t\t\tif (key === 'parent' || key === 'loc' || key === 'range') continue;\n\t\t\t\tconst child = (node as unknown as Record<string, unknown>)[key];\n\t\t\t\tif (Array.isArray(child)) {\n\t\t\t\t\tfor (const item of child) if (isAstNode(item)) walkThrows(item, fnType, visited);\n\t\t\t\t} else if (isAstNode(child)) walkThrows(child, fnType, visited);\n\t\t\t}\n\t\t}\n\n\t\tfunction enterQueryOrMutationFn(node: ESTree.ArrowFunctionExpression | ESTree.Function) {\n\t\t\tconst parent = node.parent;\n\t\t\tif (parent.type !== 'Property' || parent.key.type !== 'Identifier') return;\n\t\t\tconst name = parent.key.name;\n\t\t\tif (name === 'queryFn' || name === 'mutationFn') fnStack.push(name);\n\t\t}\n\n\t\tfunction exitQueryOrMutationFn(node: ESTree.ArrowFunctionExpression | ESTree.Function) {\n\t\t\tconst parent = node.parent;\n\t\t\tif (parent.type !== 'Property' || parent.key.type !== 'Identifier') return;\n\t\t\tconst name = parent.key.name;\n\t\t\tif (name === 'queryFn' || name === 'mutationFn') fnStack.pop();\n\t\t}\n\n\t\tfunction checkThrowStatement(node: ESTree.ThrowStatement) {\n\t\t\tif (fnStack.length === 0) return;\n\t\t\tcheckThrowNode(node, fnStack.at(-1) ?? '');\n\t\t}\n\n\t\tfunction recordExtractedRef(prop: ESTree.Node) {\n\t\t\tif (prop.type !== 'Property') return;\n\t\t\tif (\n\t\t\t\tprop.key.type !== 'Identifier' ||\n\t\t\t\t(prop.key.name !== 'queryFn' && prop.key.name !== 'mutationFn') ||\n\t\t\t\tprop.value.type !== 'Identifier'\n\t\t\t)\n\t\t\t\treturn;\n\t\t\textractedRefs.push({ name: prop.value.name, fnType: prop.key.name });\n\t\t}\n\n\t\treturn {\n\t\t\tbefore() {\n\t\t\t\tconst options = context.options[0] as { allowedErrors?: string[] } | undefined;\n\t\t\t\tconst allowedList = options?.allowedErrors ?? DEFAULT_ALLOWED_ERRORS;\n\t\t\t\tallowedErrors = new Set(allowedList);\n\t\t\t\tallowedExample = allowedList[0] ?? DEFAULT_ALLOWED_ERRORS[0];\n\t\t\t\tfnStack.length = 0;\n\t\t\t\textractedRefs.length = 0;\n\t\t\t\tmoduleFns.clear();\n\t\t\t},\n\t\t\t'Program > FunctionDeclaration'(node) {\n\t\t\t\tif (node.type !== 'FunctionDeclaration') return;\n\t\t\t\trecordModuleFn(node.id?.name, node.body);\n\t\t\t},\n\t\t\t'Program > VariableDeclaration > VariableDeclarator'(node) {\n\t\t\t\tif (node.type !== 'VariableDeclarator') return;\n\t\t\t\tif (\n\t\t\t\t\tnode.id.type === 'Identifier' &&\n\t\t\t\t\t(node.init?.type === 'ArrowFunctionExpression' || node.init?.type === 'FunctionExpression')\n\t\t\t\t)\n\t\t\t\t\trecordModuleFn(node.id.name, node.init.body);\n\t\t\t},\n\t\t\tArrowFunctionExpression: enterQueryOrMutationFn,\n\t\t\t'ArrowFunctionExpression:exit': exitQueryOrMutationFn,\n\t\t\tFunctionExpression: enterQueryOrMutationFn,\n\t\t\t'FunctionExpression:exit': exitQueryOrMutationFn,\n\t\t\tProperty: recordExtractedRef,\n\t\t\tThrowStatement: checkThrowStatement,\n\t\t\t'Program:exit'() {\n\t\t\t\tfor (const { name, fnType } of extractedRefs) {\n\t\t\t\t\tconst body = moduleFns.get(name);\n\t\t\t\t\tif (body) walkThrows(body, fnType);\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-api-error',\n\t},\n\trules: {\n\t\t'require-api-error': requireApiError,\n\t},\n});\n"],"mappings":";;;AAIA,MAAM,yBAAyB,CAAC,YAAY,qBAAqB;AAEjE,SAAS,uBAAuB,KAAkB;CACjD,IAAI,IAAI,SAAS,kBAAkB,OAAO;CAC1C,MAAM,EAAE,WAAW;CACnB,IAAI,OAAO,SAAS,sBAAsB,OAAO,UAAU,OAAO;CAClE,MAAM,EAAE,QAAQ,aAAa;CAC7B,IAAI,OAAO,SAAS,gBAAgB,SAAS,SAAS,cAAc,OAAO;CAC3E,OAAO;EAAE;EAAQ,MAAM,OAAO;CAAK;AACpC;AAEA,SAAS,UAAU,OAAsC;CACxD,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAS,OAAQ,MAA4B,SAAS;AACvH;AAEA,MAAM,kBAAkB,WAAW;CAClC,MAAM;EACL,MAAM;EACN,MAAM,EACL,aACC,iIACF;EACA,QAAQ,CACP;GACC,MAAM;GACN,sBAAsB;GACtB,YAAY,EACX,eAAe;IACd,MAAM;IACN,OAAO;KAAE,MAAM;KAAU,WAAW;IAAE;IACtC,UAAU;IACV,aAAa;GACd,EACD;EACD,CACD;EACA,UAAU;GACT,aACC;GACD,iBACC;GACD,mBACC;EACF;EACA,gBAAgB,CAAC,EAAE,eAAe,CAAC,GAAG,sBAAsB,EAAE,CAAC;CAChE;CACA,WAAW,SAAS;EACnB,IAAI,gBAAgB,IAAI,IA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QAAQ,KAAK,IAAI;GAAK,CAAC;EACpE;EAEA,OAAO;GACN,SAAS;IAER,MAAM,cADU,QAAQ,QAAQ,EACL,EAAE,iBAAiB;IAC9C,gBAAgB,IAAI,IAAI,WAAW;IACnC,iBAAiB,YAAY,MAAM,uBAAuB;IAC1D,QAAQ,SAAS;IACjB,cAAc,SAAS;IACvB,UAAU,MAAM;GACjB;GACA,gCAAgC,MAAM;IACrC,IAAI,KAAK,SAAS,uBAAuB;IACzC,eAAe,KAAK,IAAI,MAAM,KAAK,IAAI;GACxC;GACA,qDAAqD,MAAM;IAC1D,IAAI,KAAK,SAAS,sBAAsB;IACxC,IACC,KAAK,GAAG,SAAS,iBAChB,KAAK,MAAM,SAAS,6BAA6B,KAAK,MAAM,SAAS,uBAEtE,eAAe,KAAK,GAAG,MAAM,KAAK,KAAK,IAAI;GAC7C;GACA,yBAAyB;GACzB,gCAAgC;GAChC,oBAAoB;GACpB,2BAA2B;GAC3B,UAAU;GACV,gBAAgB;GAChB,iBAAiB;IAChB,KAAK,MAAM,EAAE,MAAM,YAAY,eAAe;KAC7C,MAAM,OAAO,UAAU,IAAI,IAAI;KAC/B,IAAI,MAAM,WAAW,MAAM,MAAM;IAClC;GACD;EACD;CACD;AACD,CAAC;AAED,wBAAe,aAAa;CAC3B,MAAM,EACL,MAAM,gCACP;CACA,OAAO,EACN,qBAAqB,gBACtB;AACD,CAAC"}
1
+ {"version":3,"file":"api-error.js","names":[],"sources":["../../src/plugins/api-error.ts"],"sourcesContent":["import { definePlugin, defineRule } from '@oxlint/plugins';\n\nimport type { ESTree } from '@oxlint/plugins';\n\nconst DEFAULT_ALLOWED_ERRORS = ['ApiError', 'FormValidationError'];\n\nfunction getStaticFactoryCallee(arg: ESTree.Node) {\n\tif (arg.type !== 'CallExpression') return undefined;\n\tconst { callee } = arg;\n\tif (callee.type !== 'MemberExpression' || callee.computed) return undefined;\n\tconst { object, property } = callee;\n\tif (object.type !== 'Identifier' || property.type !== 'Identifier') return undefined;\n\treturn { callee, name: object.name };\n}\n\nfunction isAstNode(value: unknown): value is ESTree.Node {\n\treturn typeof value === 'object' && value !== null && 'type' in value && typeof value.type === 'string';\n}\n\nconst requireApiError = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t'Require an allowed API error instead of Error inside queryFn/mutationFn so status codes propagate to QueryCache error handling',\n\t\t},\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\tallowedErrors: {\n\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\titems: { type: 'string', minLength: 1 },\n\t\t\t\t\t\tminItems: 1,\n\t\t\t\t\t\tuniqueItems: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tmessages: {\n\t\t\tuseApiError:\n\t\t\t\t'Use `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of `new {{thrown}}(...)` inside {{fnType}}. This ensures the HTTP status code is available in QueryCache/retry/error reporting.',\n\t\t\tuseApiErrorCall:\n\t\t\t\t'Use `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of `{{thrown}}(...)` inside {{fnType}}. This ensures the HTTP status code is available in QueryCache/retry/error reporting.',\n\t\t\tuseApiErrorMember:\n\t\t\t\t'Throw `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of re-throwing `{{thrown}}` directly inside {{fnType}}. The client error object may lose its HTTP status code in QueryCache/retry/error reporting.',\n\t\t},\n\t\tdefaultOptions: [{ allowedErrors: [...DEFAULT_ALLOWED_ERRORS] }],\n\t},\n\tcreateOnce(context) {\n\t\tlet allowedErrors = new Set(DEFAULT_ALLOWED_ERRORS);\n\t\tlet allowedExample = DEFAULT_ALLOWED_ERRORS[0];\n\t\tconst fnStack: string[] = [];\n\t\tconst extractedRefs: { name: string; fnType: string }[] = [];\n\t\tconst moduleFns = new Map<string, ESTree.Node>();\n\n\t\tfunction recordModuleFn(name: string | undefined, body: ESTree.Node | null | undefined) {\n\t\t\tif (!name || !body) return;\n\t\t\tif (!moduleFns.has(name)) moduleFns.set(name, body);\n\t\t}\n\n\t\tfunction isAllowedThrow(arg: ESTree.Node) {\n\t\t\tif (arg.type === 'NewExpression' && arg.callee.type === 'Identifier') return allowedErrors.has(arg.callee.name);\n\t\t\tconst factory = getStaticFactoryCallee(arg);\n\t\t\treturn factory !== undefined && allowedErrors.has(factory.name);\n\t\t}\n\n\t\tfunction checkThrowNode(node: ESTree.ThrowStatement, fnType: string) {\n\t\t\tconst arg = node.argument;\n\t\t\tif (isAllowedThrow(arg)) return;\n\n\t\t\tif (arg.type === 'NewExpression' && arg.callee.type === 'Identifier') {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiError',\n\t\t\t\t\tdata: { thrown: arg.callee.name, fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst factory = getStaticFactoryCallee(arg);\n\t\t\tif (factory) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiErrorCall',\n\t\t\t\t\tdata: { thrown: context.sourceCode.getText(factory.callee), fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (arg.type === 'MemberExpression') {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiErrorMember',\n\t\t\t\t\tdata: { thrown: context.sourceCode.getText(arg), fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tfunction walkThrows(node: ESTree.Node | null | undefined, fnType: string, visited = new Set<ESTree.Node>()) {\n\t\t\tif (!node || visited.has(node)) return;\n\t\t\tvisited.add(node);\n\n\t\t\tif (node.type === 'ThrowStatement') {\n\t\t\t\tcheckThrowNode(node, fnType);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tnode.type === 'FunctionDeclaration' ||\n\t\t\t\tnode.type === 'FunctionExpression' ||\n\t\t\t\tnode.type === 'ArrowFunctionExpression'\n\t\t\t) {\n\t\t\t\twalkThrows(node.body, fnType, visited);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (const key of Object.keys(node)) {\n\t\t\t\tif (key === 'parent' || key === 'loc' || key === 'range') continue;\n\t\t\t\tconst child = (node as unknown as Record<string, unknown>)[key];\n\t\t\t\tif (Array.isArray(child)) {\n\t\t\t\t\tfor (const item of child) if (isAstNode(item)) walkThrows(item, fnType, visited);\n\t\t\t\t} else if (isAstNode(child)) walkThrows(child, fnType, visited);\n\t\t\t}\n\t\t}\n\n\t\tfunction enterQueryOrMutationFn(node: ESTree.ArrowFunctionExpression | ESTree.Function) {\n\t\t\tconst parent = node.parent;\n\t\t\tif (parent.type !== 'Property' || parent.key.type !== 'Identifier') return;\n\t\t\tconst name = parent.key.name;\n\t\t\tif (name === 'queryFn' || name === 'mutationFn') fnStack.push(name);\n\t\t}\n\n\t\tfunction exitQueryOrMutationFn(node: ESTree.ArrowFunctionExpression | ESTree.Function) {\n\t\t\tconst parent = node.parent;\n\t\t\tif (parent.type !== 'Property' || parent.key.type !== 'Identifier') return;\n\t\t\tconst name = parent.key.name;\n\t\t\tif (name === 'queryFn' || name === 'mutationFn') fnStack.pop();\n\t\t}\n\n\t\tfunction checkThrowStatement(node: ESTree.ThrowStatement) {\n\t\t\tif (fnStack.length === 0) return;\n\t\t\tcheckThrowNode(node, fnStack.at(-1) ?? '');\n\t\t}\n\n\t\tfunction recordExtractedRef(prop: ESTree.Node) {\n\t\t\tif (prop.type !== 'Property') return;\n\t\t\tif (\n\t\t\t\tprop.key.type !== 'Identifier' ||\n\t\t\t\t(prop.key.name !== 'queryFn' && prop.key.name !== 'mutationFn') ||\n\t\t\t\tprop.value.type !== 'Identifier'\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\textractedRefs.push({ name: prop.value.name, fnType: prop.key.name });\n\t\t}\n\n\t\treturn {\n\t\t\tbefore() {\n\t\t\t\tconst options = context.options[0] as { allowedErrors?: string[] } | undefined;\n\t\t\t\tconst allowedList = options?.allowedErrors ?? DEFAULT_ALLOWED_ERRORS;\n\t\t\t\tallowedErrors = new Set(allowedList);\n\t\t\t\tallowedExample = allowedList[0] ?? DEFAULT_ALLOWED_ERRORS[0];\n\t\t\t\tfnStack.length = 0;\n\t\t\t\textractedRefs.length = 0;\n\t\t\t\tmoduleFns.clear();\n\t\t\t},\n\t\t\t'Program > FunctionDeclaration'(node) {\n\t\t\t\tif (node.type !== 'FunctionDeclaration') return;\n\t\t\t\trecordModuleFn(node.id?.name, node.body);\n\t\t\t},\n\t\t\t'Program > VariableDeclaration > VariableDeclarator'(node) {\n\t\t\t\tif (node.type !== 'VariableDeclarator') return;\n\t\t\t\tif (\n\t\t\t\t\tnode.id.type === 'Identifier' &&\n\t\t\t\t\t(node.init?.type === 'ArrowFunctionExpression' || node.init?.type === 'FunctionExpression')\n\t\t\t\t) {\n\t\t\t\t\trecordModuleFn(node.id.name, node.init.body);\n\t\t\t\t}\n\t\t\t},\n\t\t\tArrowFunctionExpression: enterQueryOrMutationFn,\n\t\t\t'ArrowFunctionExpression:exit': exitQueryOrMutationFn,\n\t\t\tFunctionExpression: enterQueryOrMutationFn,\n\t\t\t'FunctionExpression:exit': exitQueryOrMutationFn,\n\t\t\tProperty: recordExtractedRef,\n\t\t\tThrowStatement: checkThrowStatement,\n\t\t\t'Program:exit'() {\n\t\t\t\tfor (const { name, fnType } of extractedRefs) {\n\t\t\t\t\tconst body = moduleFns.get(name);\n\t\t\t\t\tif (body) walkThrows(body, fnType);\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-api-error',\n\t},\n\trules: {\n\t\t'require-api-error': requireApiError,\n\t},\n});\n"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C,IACC,KAAK,GAAG,SAAS,iBAChB,KAAK,MAAM,SAAS,6BAA6B,KAAK,MAAM,SAAS,uBAEtE,eAAe,KAAK,GAAG,MAAM,KAAK,KAAK,IAAI;GAE7C;GACA,yBAAyB;GACzB,gCAAgC;GAChC,oBAAoB;GACpB,2BAA2B;GAC3B,UAAU;GACV,gBAAgB;GAChB,iBAAiB;IAChB,KAAK,MAAM,EAAE,MAAM,YAAY,eAAe;KAC7C,MAAM,OAAO,UAAU,IAAI,IAAI;KAC/B,IAAI,MAAM,WAAW,MAAM,MAAM;IAClC;GACD;EACD;CACD;AACD,CAAC;AAED,wBAAe,aAAa;CAC3B,MAAM,EACL,MAAM,gCACP;CACA,OAAO,EACN,qBAAqB,gBACtB;AACD,CAAC"}
@@ -1 +1 @@
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
+ {"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\t}\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\t}\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\t}\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;EAEhE,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;GAExG;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;GAEvE;EACD;CACD;AACD,CAAC;AAED,mBAAe,aAAa;CAC3B,MAAM,EACL,MAAM,2BACP;CACA,OAAO;EACN,sBAAsB;EACtB,qBAAqB;CACtB;AACD,CAAC"}
@@ -1 +1 @@
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":";;;AAIA,MAAM,4BAAY,IAAI,IAAI,CAAC,UAAU,CAAC;AAEtC,MAAM,iBAAiB,WAAW;CACjC,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,kDACd;EACA,SAAS;EACT,UAAU;GACT,WAAW;GACX,UAAU;EACX;EACA,gBAAgB;CACjB;CACA,WAAW,SAAS;EACnB,SAAS,aAAa,MAAmB,MAAc,KAAoB;GAC1E,MAAM,UAAU,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK;GACvC,MAAM,UAAU,QAAQ,SAAS,MAAM;GACvC,MAAM,aAAa,QAAQ,SAAS,UAAU;GAC9C,MAAM,aAAa,QAAQ,SAAS,UAAU;GAC9C,MAAM,qBAAqB,QAAQ,QAAQ,OAAO,UAAU,IAAI,EAAE,CAAC;GAEnE,IAAI,CAAC,WAAW,mBAAmB,WAAW,GAAG;GAEjD,IAAI,WAAW,YAAY;IAC1B,QAAQ,OAAO;KACd;KACA,WAAW;KACX,MAAM,EAAE,KAAK,iBAAiB;KAC9B,IAAI,OAAO;MAEV,MAAM,eADO,QAAQ,QAAQ,OAAO,OAAO,UAAU,CAAC,UAAU,IAAI,EAAE,CAC9C,CAAC,CAAC,KAAK,GAAG;MAClC,MAAM,SAAS,OAAO,KAAG,CAAE,WAAW,GAAG,IAAI,MAAM;MACnD,OAAO,MAAM,YAAY,MAAM,GAAG,QAA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A,WAAW;IACX,MAAM,EAAE,KAAK,mBAAmB,KAAK,IAAI,EAAE;IAC3C,IAAI,OAAO;KAEV,MAAM,eADO,QAAQ,QAAQ,OAAO,CAAC,UAAU,IAAI,EAAE,CAC7B,CAAC,CAAC,KAAK,GAAG;KAClC,MAAM,SAAS,OAAO,KAAG,CAAE,WAAW,GAAG,IAAI,MAAM;KACnD,OAAO,MAAM,YAAY,MAAM,GAAG,QAAQ,eAAe,OAAO;IACjE;GACD,CAAC;EAEH;EAEA,OAAO,EACN,aAAa,MAAM;GAClB,IAAI,KAAK,KAAK,SAAS,mBAAmB,KAAK,KAAK,SAAS,aAAa;GAE1E,IAAI,KAAK,OAAO,SAAS,aAAa,OAAO,KAAK,MAAM,UAAU,UAAU;IAC3E,aAAa,KAAK,OAAO,KAAK,MAAM,OAAO,KAAK,MAAM,GAAG;IACzD;GACD;GAEA,IACC,KAAK,OAAO,SAAS,4BACrB,KAAK,MAAM,WAAW,SAAS,aAC/B,OAAO,KAAK,MAAM,WAAW,UAAU,UAEvC,aAAa,KAAK,MAAM,YAAY,KAAK,MAAM,WAAW,OAAO,KAAK,MAAM,WAAW,GAAG;EAC5F,EACD;CACD;AACD,CAAC;AAED,8BAAe,aAAa;CAC3B,MAAM,EACL,MAAM,sCACP;CACA,OAAO,EACN,oBAAoB,eACrB;AACD,CAAC"}
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\t}\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":";;;AAIA,MAAM,4BAAY,IAAI,IAAI,CAAC,UAAU,CAAC;AAEtC,MAAM,iBAAiB,WAAW;CACjC,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,kDACd;EACA,SAAS;EACT,UAAU;GACT,WAAW;GACX,UAAU;EACX;EACA,gBAAgB;CACjB;CACA,WAAW,SAAS;EACnB,SAAS,aAAa,MAAmB,MAAc,KAAoB;GAC1E,MAAM,UAAU,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK;GACvC,MAAM,UAAU,QAAQ,SAAS,MAAM;GACvC,MAAM,aAAa,QAAQ,SAAS,UAAU;GAC9C,MAAM,aAAa,QAAQ,SAAS,UAAU;GAC9C,MAAM,qBAAqB,Q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CAAC"}
@@ -1 +1 @@
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
+ {"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(\n\tnode: ESTree.ArrayExpressionElement,\n): 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') {\n\t\treturn node.callee.object.name;\n\t}\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,WACR,MACqF;CACrF,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,cAC1E,OAAO,KAAK,OAAO,OAAO;CAE3B,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"}
@@ -14,7 +14,7 @@ function isAstNode(value) {
14
14
  function pathValue(node, path) {
15
15
  let current = node;
16
16
  for (const part of path.split(".")) {
17
- if (current == null || typeof current !== "object") return void 0;
17
+ if (current === null || current === void 0 || typeof current !== "object") return void 0;
18
18
  current = current[part];
19
19
  }
20
20
  return current;
@@ -24,7 +24,7 @@ function matchAttributes(node, attributes) {
24
24
  const expression = attribute[1];
25
25
  const equal = /^(.+?)=(?:'([^']*)'|"([^"]*)")$/.exec(expression);
26
26
  if (!equal) return false;
27
- if (String(pathValue(node, equal[1].trim())) !== (equal[2] ?? equal[3])) return false;
27
+ if (String(pathValue(node, equal[1].trim())) !== (equal.at(2) ?? equal.at(3))) return false;
28
28
  }
29
29
  return true;
30
30
  }
@@ -33,7 +33,7 @@ function matchSimple(node, simple) {
33
33
  if (!type || node.type !== type) return false;
34
34
  const not = /:not\((?<inner>[^)]*)\)/.exec(simple);
35
35
  if (not?.groups?.inner && matchAttributes(node, not.groups.inner)) return false;
36
- return matchAttributes(node, simple.replace(/:not\([^)]*\)/g, ""));
36
+ return matchAttributes(node, simple.replaceAll(/:not\([^)]*\)/g, ""));
37
37
  }
38
38
  function matchSelector(node, selector) {
39
39
  const parts = selector.split(/\s*>\s*/);
@@ -1 +1 @@
1
- {"version":3,"file":"restricted-syntax.js","names":[],"sources":["../../src/plugins/restricted-syntax.ts"],"sourcesContent":["import { definePlugin, defineRule } from '@oxlint/plugins';\n\nimport type { ESTree } from '@oxlint/plugins';\n\ntype Restriction =\n\t| string\n\t| {\n\t\t\tmessage?: string;\n\t\t\tselector: string;\n\t };\n\nfunction restrictionSelector(restriction: Restriction) {\n\treturn typeof restriction === 'string' ? restriction : restriction.selector;\n}\n\nfunction restrictionMessage(restriction: Restriction) {\n\tif (typeof restriction === 'string') return `Using '${restriction}' is not allowed.`;\n\treturn restriction.message ?? `Using '${restriction.selector}' is not allowed.`;\n}\n\nfunction isAstNode(value: unknown): value is ESTree.Node {\n\treturn typeof value === 'object' && value !== null && 'type' in value && typeof (value as { type: unknown }).type === 'string';\n}\n\nfunction pathValue(node: ESTree.Node, path: string) {\n\tlet current: unknown = node;\n\tfor (const part of path.split('.')) {\n\t\tif (current == null || typeof current !== 'object') return undefined;\n\t\tcurrent = (current as Record<string, unknown>)[part];\n\t}\n\treturn current;\n}\n\nfunction matchAttributes(node: ESTree.Node, attributes: string) {\n\tfor (const attribute of attributes.matchAll(/\\[([^\\]]+)\\]/g)) {\n\t\tconst expression = attribute[1];\n\t\tconst equal = /^(.+?)=(?:'([^']*)'|\"([^\"]*)\")$/.exec(expression);\n\t\tif (!equal) return false;\n\t\tif (String(pathValue(node, equal[1].trim())) !== (equal[2] ?? equal[3])) return false;\n\t}\n\treturn true;\n}\n\nfunction matchSimple(node: ESTree.Node, simple: string) {\n\tconst type = /^(?<type>[A-Za-z]+)/.exec(simple)?.groups?.type;\n\tif (!type || node.type !== type) return false;\n\tconst not = /:not\\((?<inner>[^)]*)\\)/.exec(simple);\n\tif (not?.groups?.inner && matchAttributes(node, not.groups.inner)) return false;\n\treturn matchAttributes(node, simple.replace(/:not\\([^)]*\\)/g, ''));\n}\n\nfunction matchSelector(node: ESTree.Node, selector: string) {\n\tconst parts = selector.split(/\\s*>\\s*/);\n\tlet current: ESTree.Node | null | undefined = node;\n\tfor (let index = parts.length - 1; index >= 0; index--) {\n\t\tif (!current || !matchSimple(current, parts[index] ?? '')) return false;\n\t\tcurrent = index > 0 ? current.parent : current;\n\t}\n\treturn true;\n}\n\nfunction walk(node: ESTree.Node, visit: (current: ESTree.Node) => void, seen = new Set<ESTree.Node>()) {\n\tif (seen.has(node)) return;\n\tseen.add(node);\n\tvisit(node);\n\tfor (const key of Object.keys(node)) {\n\t\tif (key === 'parent' || key === 'loc' || key === 'range') continue;\n\t\tconst child = (node as unknown as Record<string, unknown>)[key];\n\t\tif (Array.isArray(child)) {\n\t\t\tfor (const item of child) if (isAstNode(item)) walk(item, visit, seen);\n\t\t} else if (isAstNode(child)) walk(child, visit, seen);\n\t}\n}\n\nconst noRestrictedSyntax = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow specified syntax via ESLint selectors',\n\t\t},\n\t\tschema: {\n\t\t\ttype: 'array',\n\t\t\titems: {\n\t\t\t\toneOf: [\n\t\t\t\t\t{ type: 'string', minLength: 1 },\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t\t\trequired: ['selector'],\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tselector: { type: 'string', minLength: 1 },\n\t\t\t\t\t\t\tmessage: { type: 'string', minLength: 1 },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tmessages: {\n\t\t\trestricted: '{{message}}',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tlet restrictions: Restriction[] = [];\n\t\treturn {\n\t\t\tbefore() {\n\t\t\t\trestrictions = Array.isArray(context.options) ? [...(context.options as Restriction[])] : [];\n\t\t\t\treturn restrictions.length > 0;\n\t\t\t},\n\t\t\tProgram(program) {\n\t\t\t\twalk(program, (node) => {\n\t\t\t\t\tfor (const restriction of restrictions) {\n\t\t\t\t\t\tif (!matchSelector(node, restrictionSelector(restriction))) continue;\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\tmessageId: 'restricted',\n\t\t\t\t\t\t\tdata: { message: restrictionMessage(restriction) },\n\t\t\t\t\t\t});\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-restricted-syntax',\n\t},\n\trules: {\n\t\t'no-restricted-syntax': noRestrictedSyntax,\n\t},\n});\n"],"mappings":";;;AAWA,SAAS,oBAAoB,aAA0B;CACtD,OAAO,OAAO,gBAAgB,WAAW,cAAc,YAAY;AACpE;AAEA,SAAS,mBAAmB,aAA0B;CACrD,IAAI,OAAO,gBAAgB,UAAU,OAAO,UAAU,YAAY;CAClE,OAAO,YAAY,WAAW,UAAU,YAAY,SAAS;AAC9D;AAEA,SAAS,UAAU,OAAsC;CACxD,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAS,OAAQ,MAA4B,SAAS;AACvH;AAEA,SAAS,UAAU,MAAmB,MAAc;CACnD,IAAI,UAAmB;CACvB,KAAK,MAAM,QAAQ,KAAK,MAAM,GAAG,GAAG;EACnC,IAAI,WAAW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M,QAAS,KAA4C;EAC3D,IAAI,MAAM,QAAQ,KAAK,GACtB;QAAK,MAAM,QAAQ,OAAO,IAAI,UAAU,IAAI,GAAG,KAAK,MAAM,OAAO,IAAI;EAAC,OAChE,IAAI,UAAU,KAAK,GAAG,KAAK,OAAO,OAAO,IAAI;CACrD;AACD;AAEA,MAAM,qBAAqB,WAAW;CACrC,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,iDACd;EACA,QAAQ;GACP,MAAM;GACN,OAAO,EACN,OAAO,CACN;IAAE,MAAM;IAAU,WAAW;GAAE,GAC/B;IACC,MAAM;IACN,sBAAsB;IACtB,UAAU,CAAC,UAAU;IACrB,YAAY;KACX,UAAU;MAAE,MAAM;MAAU,WAAW;KAAE;KACzC,SAAS;MAAE,MAAM;MAAU,WAAW;KAAE;IACzC;GACD,CACD,EACD;EACD;EACA,UAAU,EACT,YAAY,cACb;CACD;CACA,WAAW,SAAS;EACnB,IAAI,eAA8B,CAAC;EACnC,OAAO;GACN,SAAS;IACR,eAAe,MAAM,QAAQ,QAAQ,OAAO,IAAI,CAAC,GAAI,QAAQ,OAAyB,IAAI,CAAC;IAC3F,OAAO,aAAa,SAAS;GAC9B;GACA,QAAQ,SAAS;IAChB,KAAK,UAAU,SAAS;KACvB,KAAK,MAAM,eAAe,cAAc;MACvC,IAAI,CAAC,cAAc,MAAM,oBAAoB,WAAW,CAAC,GAAG;MAC5D,QAAQ,OAAO;OACd;OACA,WAAW;OACX,MAAM,EAAE,SAAS,mBAAmB,WAAW,EAAE;MAClD,CAAC;KACF;IACD,CAAC;GACF;EACD;CACD;AACD,CAAC;AAED,gCAAe,aAAa;CAC3B,MAAM,EACL,MAAM,wCACP;CACA,OAAO,EACN,wBAAwB,mBACzB;AACD,CAAC"}
1
+ {"version":3,"file":"restricted-syntax.js","names":[],"sources":["../../src/plugins/restricted-syntax.ts"],"sourcesContent":["import { definePlugin, defineRule } from '@oxlint/plugins';\n\nimport type { ESTree } from '@oxlint/plugins';\n\ntype Restriction =\n\t| string\n\t| {\n\t\t\tmessage?: string;\n\t\t\tselector: string;\n\t };\n\nfunction restrictionSelector(restriction: Restriction) {\n\treturn typeof restriction === 'string' ? restriction : restriction.selector;\n}\n\nfunction restrictionMessage(restriction: Restriction) {\n\tif (typeof restriction === 'string') return `Using '${restriction}' is not allowed.`;\n\treturn restriction.message ?? `Using '${restriction.selector}' is not allowed.`;\n}\n\nfunction isAstNode(value: unknown): value is ESTree.Node {\n\treturn typeof value === 'object' && value !== null && 'type' in value && typeof value.type === 'string';\n}\n\nfunction pathValue(node: ESTree.Node, path: string) {\n\tlet current: unknown = node;\n\tfor (const part of path.split('.')) {\n\t\tif (current === null || current === undefined || typeof current !== 'object') return undefined;\n\t\tcurrent = (current as Record<string, unknown>)[part];\n\t}\n\treturn current;\n}\n\nfunction matchAttributes(node: ESTree.Node, attributes: string) {\n\tfor (const attribute of attributes.matchAll(/\\[([^\\]]+)\\]/g)) {\n\t\tconst expression = attribute[1];\n\t\tconst equal = /^(.+?)=(?:'([^']*)'|\"([^\"]*)\")$/.exec(expression);\n\t\tif (!equal) return false;\n\t\tif (String(pathValue(node, equal[1].trim())) !== (equal.at(2) ?? equal.at(3))) return false;\n\t}\n\treturn true;\n}\n\nfunction matchSimple(node: ESTree.Node, simple: string) {\n\tconst type = /^(?<type>[A-Za-z]+)/.exec(simple)?.groups?.type;\n\tif (!type || node.type !== type) return false;\n\tconst not = /:not\\((?<inner>[^)]*)\\)/.exec(simple);\n\tif (not?.groups?.inner && matchAttributes(node, not.groups.inner)) return false;\n\treturn matchAttributes(node, simple.replaceAll(/:not\\([^)]*\\)/g, ''));\n}\n\nfunction matchSelector(node: ESTree.Node, selector: string) {\n\tconst parts = selector.split(/\\s*>\\s*/);\n\tlet current: ESTree.Node | null | undefined = node;\n\tfor (let index = parts.length - 1; index >= 0; index--) {\n\t\tif (!current || !matchSimple(current, parts[index] ?? '')) return false;\n\t\tcurrent = index > 0 ? current.parent : current;\n\t}\n\treturn true;\n}\n\nfunction walk(node: ESTree.Node, visit: (current: ESTree.Node) => void, seen = new Set<ESTree.Node>()) {\n\tif (seen.has(node)) return;\n\tseen.add(node);\n\tvisit(node);\n\tfor (const key of Object.keys(node)) {\n\t\tif (key === 'parent' || key === 'loc' || key === 'range') continue;\n\t\tconst child = (node as unknown as Record<string, unknown>)[key];\n\t\tif (Array.isArray(child)) {\n\t\t\tfor (const item of child) if (isAstNode(item)) walk(item, visit, seen);\n\t\t} else if (isAstNode(child)) walk(child, visit, seen);\n\t}\n}\n\nconst noRestrictedSyntax = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow specified syntax via ESLint selectors',\n\t\t},\n\t\tschema: {\n\t\t\ttype: 'array',\n\t\t\titems: {\n\t\t\t\toneOf: [\n\t\t\t\t\t{ type: 'string', minLength: 1 },\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t\t\trequired: ['selector'],\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tselector: { type: 'string', minLength: 1 },\n\t\t\t\t\t\t\tmessage: { type: 'string', minLength: 1 },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tmessages: {\n\t\t\trestricted: '{{message}}',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tlet restrictions: Restriction[] = [];\n\t\treturn {\n\t\t\tbefore() {\n\t\t\t\trestrictions = Array.isArray(context.options) ? [...(context.options as Restriction[])] : [];\n\t\t\t\treturn restrictions.length > 0;\n\t\t\t},\n\t\t\tProgram(program) {\n\t\t\t\twalk(program, (node) => {\n\t\t\t\t\tfor (const restriction of restrictions) {\n\t\t\t\t\t\tif (!matchSelector(node, restrictionSelector(restriction))) continue;\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\tmessageId: 'restricted',\n\t\t\t\t\t\t\tdata: { message: restrictionMessage(restriction) },\n\t\t\t\t\t\t});\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-restricted-syntax',\n\t},\n\trules: {\n\t\t'no-restricted-syntax': noRestrictedSyntax,\n\t},\n});\n"],"mappings":";;;AAWA,SAAS,oBAAoB,aAA0B;CACtD,OAAO,OAAO,gBAAgB,WAAW,cAAc,YAAY;AACpE;AAEA,SAAS,mBAAmB,aAA0B;CACrD,IAAI,OAAO,gBAAgB,UAAU,OAAO,UAAU,YAAY;CAClE,OAAO,YAAY,WAAW,UAAU,YAAY,SAAS;AAC9D;AAEA,SAAS,UAAU,OAAsC;CACxD,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAS,OAAO,MAAM,SAAS;AAChG;AAEA,SAAS,UAAU,MAAmB,MAAc;CACnD,IAAI,UAAmB;CACvB,KAAK,MAAM,QAAQ,KAAK,MAAM,GAAG,GAAG;EACnC,IAAI,YAAY,QAAQ,YAAY,UAAa,OAAO,YAAY,UAAU,OAAO;EACrF,UAAW,QAAoC;CAChD;CACA,OAAO;AACR;AAEA,SAAS,gBAAgB,MAAmB,YAAoB;CAC/D,KAAK,MAAM,aAAa,WAAW,SAAS,eAAe,GAAG;EAC7D,MAAM,aAAa,UAAU;EAC7B,MAAM,QAAQ,kCAAkC,KAAK,UAAU;EAC/D,IAAI,CAAC,OAAO,OAAO;EACnB,IAAI,OAAO,UAAU,MAAM,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,OAAO,MAAM,GAAG,CAAC,KAAK,MAAM,GAAG,CAAC,IAAI,OAAO;CACvF;CACA,OAAO;AACR;AAEA,SAAS,YAAY,MAAmB,QAAgB;CACvD,MAAM,OAAO,sBAAsB,KAAK,MAAM,CAAC,EAAE,QAAQ;CACzD,IAAI,CAAC,QAAQ,KAAK,SAAS,MAAM,OAAO;CACxC,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ACD;EACA,UAAU,EACT,YAAY,cACb;CACD;CACA,WAAW,SAAS;EACnB,IAAI,eAA8B,CAAC;EACnC,OAAO;GACN,SAAS;IACR,eAAe,MAAM,QAAQ,QAAQ,OAAO,IAAI,CAAC,GAAI,QAAQ,OAAyB,IAAI,CAAC;IAC3F,OAAO,aAAa,SAAS;GAC9B;GACA,QAAQ,SAAS;IAChB,KAAK,UAAU,SAAS;KACvB,KAAK,MAAM,eAAe,cAAc;MACvC,IAAI,CAAC,cAAc,MAAM,oBAAoB,WAAW,CAAC,GAAG;MAC5D,QAAQ,OAAO;OACd;OACA,WAAW;OACX,MAAM,EAAE,SAAS,mBAAmB,WAAW,EAAE;MAClD,CAAC;KACF;IACD,CAAC;GACF;EACD;CACD;AACD,CAAC;AAED,gCAAe,aAAa;CAC3B,MAAM,EACL,MAAM,wCACP;CACA,OAAO,EACN,wBAAwB,mBACzB;AACD,CAAC"}
@@ -3,15 +3,14 @@ declare const config: {
3
3
  plugins: ("eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue")[];
4
4
  jsPlugins: import("oxlint").ExternalPluginEntry[];
5
5
  settings: {
6
- 'better-tailwindcss': {
6
+ tailwindcss: {
7
7
  entryPoint: string;
8
8
  };
9
9
  };
10
10
  rules: {
11
- 'better-tailwindcss-js/enforce-consistent-class-order': "warn";
12
- 'better-tailwindcss-js/no-unnecessary-whitespace': "warn";
13
- 'better-tailwindcss-js/enforce-canonical-classes': "warn";
14
- 'better-tailwindcss-js/no-unknown-classes': "error";
11
+ 'tailwindcss/enforce-sort-order': "warn";
12
+ 'tailwindcss/no-unnecessary-whitespace': "warn";
13
+ 'tailwindcss/enforce-canonical': "warn";
15
14
  };
16
15
  };
17
16
  //#endregion
package/dist/tailwind.js CHANGED
@@ -4,13 +4,12 @@ import { defineConfig } from "oxlint";
4
4
  //#region src/tailwind.ts
5
5
  const config = defineConfig({
6
6
  plugins: nativePlugins,
7
- jsPlugins: [packagePlugin("better-tailwindcss-js", "eslint-plugin-better-tailwindcss")],
8
- settings: { "better-tailwindcss": { entryPoint: "app/globals.css" } },
7
+ jsPlugins: [packagePlugin("tailwindcss", "oxlint-tailwindcss")],
8
+ settings: { tailwindcss: { entryPoint: "app/globals.css" } },
9
9
  rules: {
10
- "better-tailwindcss-js/enforce-consistent-class-order": "warn",
11
- "better-tailwindcss-js/no-unnecessary-whitespace": "warn",
12
- "better-tailwindcss-js/enforce-canonical-classes": "warn",
13
- "better-tailwindcss-js/no-unknown-classes": "error"
10
+ "tailwindcss/enforce-sort-order": "warn",
11
+ "tailwindcss/no-unnecessary-whitespace": "warn",
12
+ "tailwindcss/enforce-canonical": "warn"
14
13
  }
15
14
  });
16
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind.js","names":[],"sources":["../src/tailwind.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { nativePlugins, packagePlugin } from './config.js';\n\nconst config = defineConfig({\n\tplugins: nativePlugins,\n\tjsPlugins: [packagePlugin('better-tailwindcss-js', 'eslint-plugin-better-tailwindcss')],\n\tsettings: {\n\t\t'better-tailwindcss': {\n\t\t\tentryPoint: 'app/globals.css',\n\t\t},\n\t},\n\trules: {\n\t\t'better-tailwindcss-js/enforce-consistent-class-order': 'warn',\n\t\t'better-tailwindcss-js/no-unnecessary-whitespace': 'warn',\n\t\t'better-tailwindcss-js/enforce-canonical-classes': 'warn',\n\t\t'better-tailwindcss-js/no-unknown-classes': 'error',\n\t},\n});\n\nexport default config;\n"],"mappings":";;;;AAIA,MAAM,SAAS,aAAa;CAC3B,SAAS;CACT,WAAW,CAAC,cAAc,yBAAyB,kCAAkC,CAAC;CACtF,UAAU,EACT,sBAAsB,EACrB,YAAY,kBACb,EACD;CACA,OAAO;EACN,wDAAwD;EACxD,mDAAmD;EACnD,mDAAmD;EACnD,4CAA4C;CAC7C;AACD,CAAC"}
1
+ {"version":3,"file":"tailwind.js","names":[],"sources":["../src/tailwind.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { nativePlugins, packagePlugin } from './config.js';\n\nconst config = defineConfig({\n\tplugins: nativePlugins,\n\tjsPlugins: [packagePlugin('tailwindcss', 'oxlint-tailwindcss')],\n\tsettings: {\n\t\ttailwindcss: {\n\t\t\tentryPoint: 'app/globals.css',\n\t\t},\n\t},\n\trules: {\n\t\t'tailwindcss/enforce-sort-order': 'warn',\n\t\t'tailwindcss/no-unnecessary-whitespace': 'warn',\n\t\t'tailwindcss/enforce-canonical': 'warn',\n\t},\n});\n\nexport default config;\n"],"mappings":";;;;AAIA,MAAM,SAAS,aAAa;CAC3B,SAAS;CACT,WAAW,CAAC,cAAc,eAAe,oBAAoB,CAAC;CAC9D,UAAU,EACT,aAAa,EACZ,YAAY,kBACb,EACD;CACA,OAAO;EACN,kCAAkC;EAClC,yCAAyC;EACzC,iCAAiC;CAClC;AACD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imranbarbhuiya/oxc-config",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Shared Oxlint and Oxfmt configs for JavaScript and TypeScript projects",
5
5
  "keywords": [
6
6
  "config",
@@ -196,22 +196,22 @@
196
196
  "@clack/prompts": "^1.7.0",
197
197
  "@oxlint/plugins": "1.80.0",
198
198
  "eslint": "^10.9.1",
199
- "eslint-plugin-better-tailwindcss": "^4.6.1",
200
- "eslint-plugin-jsdoc": "^63.0.12",
201
- "eslint-plugin-n": "^18.2.1",
199
+ "eslint-plugin-jsdoc": "^64.2.1",
200
+ "eslint-plugin-n": "^18.3.0",
202
201
  "eslint-plugin-react": "^7.37.5",
203
- "eslint-plugin-sonarjs": "^4.1.0",
202
+ "eslint-plugin-sonarjs": "^4.2.0",
204
203
  "eslint-plugin-tsdoc": "^0.5.2",
205
- "nypm": "^0.6.8"
204
+ "nypm": "^0.6.9",
205
+ "oxlint-tailwindcss": "^1.10.2"
206
206
  },
207
207
  "devDependencies": {
208
208
  "@types/bun": "^1.4.0",
209
209
  "@types/node": "^25.9.5",
210
- "@typescript-eslint/utils": "^8.63.0",
210
+ "@typescript-eslint/utils": "^8.68.0",
211
211
  "oxfmt": "^0.65.0",
212
212
  "oxlint": "^1.80.0",
213
213
  "oxlint-tsgolint": "^7.0.2001",
214
- "tsdown": "^0.22.4",
214
+ "tsdown": "^0.22.14",
215
215
  "typescript": "6.0.3"
216
216
  },
217
217
  "peerDependencies": {
@@ -232,6 +232,6 @@
232
232
  "zod-validation-error": "^4"
233
233
  },
234
234
  "engines": {
235
- "node": ">=22.18.0"
235
+ "node": ">=22.22.2"
236
236
  }
237
237
  }