Skip to content

Commit

Permalink
feat: add buildFromOxlintConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Sysix committed Oct 25, 2024
1 parent 8890a8c commit d65022a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 398 deletions.
349 changes: 2 additions & 347 deletions src/__snapshots__/build-from-oxlint-config.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,387 +1,42 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`detects active categories and append its rules > simpleCategoryActive 1`] = `
exports[`custom plugins, default categories > customPluginDefaultCategories 1`] = `
{
"@typescript-eslint/no-dupe-class-members": "off",
"@typescript-eslint/no-duplicate-enum-values": "off",
"@typescript-eslint/no-extra-non-null-assertion": "off",
"@typescript-eslint/no-loss-of-precision": "off",
"@typescript-eslint/no-misused-new": "off",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-unsafe-declaration-merging": "off",
"@typescript-eslint/triple-slash-reference": "off",
"import/default": "off",
"import/named": "off",
"import/namespace": "off",
"jest/expect-expect": "off",
"jest/no-conditional-expect": "off",
"jest/no-disabled-tests": "off",
"jest/no-export": "off",
"jest/no-standalone-expect": "off",
"jest/require-to-throw-message": "off",
"jest/valid-describe-callback": "off",
"jest/valid-expect": "off",
"jest/valid-title": "off",
"jsdoc/check-property-names": "off",
"jsdoc/check-tag-names": "off",
"jsdoc/implements-on-classes": "off",
"jsdoc/no-defaults": "off",
"jsdoc/require-property": "off",
"jsdoc/require-property-description": "off",
"jsdoc/require-property-name": "off",
"jsdoc/require-property-type": "off",
"jsdoc/require-yields": "off",
"jsx-a11y/alt-text": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/aria-activedescendant-has-tabindex": "off",
"jsx-a11y/aria-role": "off",
"jsx-a11y/autocomplete-valid": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/heading-has-content": "off",
"jsx-a11y/html-has-lang": "off",
"jsx-a11y/iframe-has-title": "off",
"jsx-a11y/img-redundant-alt": "off",
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/lang": "off",
"jsx-a11y/media-has-caption": "off",
"jsx-a11y/mouse-events-have-key-events": "off",
"jsx-a11y/no-access-key": "off",
"jsx-a11y/no-distracting-elements": "off",
"jsx-a11y/prefer-tag-over-role": "off",
"jsx-a11y/role-has-required-aria-props": "off",
"jsx-a11y/role-supports-aria-props": "off",
"nextjs/google-font-display": "off",
"nextjs/google-font-preconnect": "off",
"nextjs/inline-script-id": "off",
"nextjs/next-script-for-ga": "off",
"nextjs/no-assign-module-variable": "off",
"nextjs/no-async-client-component": "off",
"nextjs/no-before-interactive-script-outside-document": "off",
"nextjs/no-css-tags": "off",
"nextjs/no-document-import-in-page": "off",
"nextjs/no-duplicate-head": "off",
"nextjs/no-head-element": "off",
"nextjs/no-head-import-in-document": "off",
"nextjs/no-img-element": "off",
"nextjs/no-page-custom-font": "off",
"nextjs/no-script-component-in-head": "off",
"nextjs/no-styled-jsx-in-document": "off",
"nextjs/no-sync-scripts": "off",
"nextjs/no-title-in-document-head": "off",
"nextjs/no-unwanted-polyfillio": "off",
"no-async-promise-executor": "off",
"no-caller": "off",
"no-class-assign": "off",
"no-cond-assign": "off",
"no-const-assign": "off",
"no-constant-binary-expression": "off",
"no-constant-condition": "off",
"no-control-regex": "off",
"no-delete-var": "off",
"no-dupe-class-members": "off",
"no-dupe-else-if": "off",
"no-dupe-keys": "off",
"no-duplicate-case": "off",
"no-empty-character-class": "off",
"no-empty-pattern": "off",
"no-ex-assign": "off",
"no-func-assign": "off",
"no-global-assign": "off",
"no-import-assign": "off",
"no-invalid-regexp": "off",
"no-irregular-whitespace": "off",
"no-loss-of-precision": "off",
"no-new-native-nonconstructor": "off",
"no-obj-calls": "off",
"no-self-assign": "off",
"no-setter-return": "off",
"no-shadow-restricted-names": "off",
"no-sparse-arrays": "off",
"no-this-before-super": "off",
"no-unsafe-finally": "off",
"no-unsafe-optional-chaining": "off",
"no-unused-private-class-members": "off",
"no-useless-catch": "off",
"no-useless-rename": "off",
"no-with": "off",
"promise/no-callback-in-promise": "off",
"promise/valid-params": "off",
"react/jsx-key": "off",
"react/jsx-no-duplicate-props": "off",
"react/jsx-no-target-blank": "off",
"react/jsx-no-undef": "off",
"react/no-children-prop": "off",
"react/no-danger-with-children": "off",
"react/no-direct-mutation-state": "off",
"react/no-find-dom-node": "off",
"react/no-is-mounted": "off",
"react/no-render-return-value": "off",
"react/no-string-refs": "off",
"react/void-dom-elements-no-children": "off",
"require-yield": "off",
"unicorn/no-await-in-promise-methods": "off",
"unicorn/no-document-cookie": "off",
"unicorn/no-empty-file": "off",
"unicorn/no-invalid-remove-event-listener": "off",
"unicorn/no-thenable": "off",
"vitest/no-conditional-tests": "off",
}
`;

exports[`detects plugin and append its rules > detectPluginRules 1`] = `
{
"unicorn/catch-error-name": "off",
"unicorn/consistent-function-scoping": "off",
"unicorn/empty-brace-spaces": "off",
"unicorn/error-message": "off",
"unicorn/escape-case": "off",
"unicorn/explicit-length-check": "off",
"unicorn/filename-case": "off",
"unicorn/new-for-builtins": "off",
"unicorn/no-abusive-eslint-disable": "off",
"unicorn/no-anonymous-default-export": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-await-expression-member": "off",
"unicorn/no-await-in-promise-methods": "off",
"unicorn/no-console-spaces": "off",
"unicorn/no-document-cookie": "off",
"unicorn/no-empty-file": "off",
"unicorn/no-hex-escape": "off",
"unicorn/no-instanceof-array": "off",
"unicorn/no-invalid-remove-event-listener": "off",
"unicorn/no-length-as-slice-end": "off",
"unicorn/no-lonely-if": "off",
"unicorn/no-magic-array-flat-depth": "off",
"unicorn/no-negated-condition": "off",
"unicorn/no-negation-in-equality-check": "off",
"unicorn/no-nested-ternary": "off",
"unicorn/no-new-array": "off",
"unicorn/no-new-buffer": "off",
"unicorn/no-null": "off",
"unicorn/no-object-as-default-parameter": "off",
"unicorn/no-process-exit": "off",
"unicorn/no-single-promise-in-promise-methods": "off",
"unicorn/no-static-only-class": "off",
"unicorn/no-thenable": "off",
"unicorn/no-this-assignment": "off",
"unicorn/no-typeof-undefined": "off",
"unicorn/no-unnecessary-await": "off",
"unicorn/no-unreadable-array-destructuring": "off",
"unicorn/no-unreadable-iife": "off",
"unicorn/no-useless-fallback-in-spread": "off",
"unicorn/no-useless-length-check": "off",
"unicorn/no-useless-promise-resolve-reject": "off",
"unicorn/no-useless-spread": "off",
"unicorn/no-useless-switch-case": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/no-zero-fractions": "off",
"unicorn/number-literal-case": "off",
"unicorn/numeric-separators-style": "off",
"unicorn/prefer-add-event-listener": "off",
"unicorn/prefer-array-flat": "off",
"unicorn/prefer-array-flat-map": "off",
"unicorn/prefer-array-some": "off",
"unicorn/prefer-blob-reading-methods": "off",
"unicorn/prefer-code-point": "off",
"unicorn/prefer-date-now": "off",
"unicorn/prefer-dom-node-append": "off",
"unicorn/prefer-dom-node-dataset": "off",
"unicorn/prefer-dom-node-remove": "off",
"unicorn/prefer-dom-node-text-content": "off",
"unicorn/prefer-event-target": "off",
"unicorn/prefer-includes": "off",
"unicorn/prefer-logical-operator-over-ternary": "off",
"unicorn/prefer-math-trunc": "off",
"unicorn/prefer-modern-dom-apis": "off",
"unicorn/prefer-modern-math-apis": "off",
"unicorn/prefer-native-coercion-functions": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-number-properties": "off",
"unicorn/prefer-optional-catch-binding": "off",
"unicorn/prefer-prototype-methods": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/prefer-reflect-apply": "off",
"unicorn/prefer-regexp-test": "off",
"unicorn/prefer-set-size": "off",
"unicorn/prefer-spread": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prefer-string-slice": "off",
"unicorn/prefer-string-starts-ends-with": "off",
"unicorn/prefer-string-trim-start-end": "off",
"unicorn/prefer-structured-clone": "off",
"unicorn/prefer-type-error": "off",
"unicorn/require-array-join-separator": "off",
"unicorn/require-number-to-fixed-digits-argument": "off",
"unicorn/switch-case-braces": "off",
"unicorn/text-encoding-identifier-case": "off",
"unicorn/throw-new-error": "off",
}
`;

exports[`enables default plugin rules (react, unicorn, typescript) > defaultPluginRules 1`] = `
exports[`default plugins (react, unicorn, typescript), default categories > defaultPluginDefaultCategories 1`] = `
{
"@typescript-eslint/adjacent-overload-signatures": "off",
"@typescript-eslint/array-type": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-tslint-comment": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/consistent-indexed-object-style": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/default-param-last": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/max-params": "off",
"@typescript-eslint/no-array-constructor": "off",
"@typescript-eslint/no-confusing-non-null-assertion": "off",
"@typescript-eslint/no-dupe-class-members": "off",
"@typescript-eslint/no-duplicate-enum-values": "off",
"@typescript-eslint/no-dynamic-delete": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-non-null-assertion": "off",
"@typescript-eslint/no-extraneous-class": "off",
"@typescript-eslint/no-import-type-side-effects": "off",
"@typescript-eslint/no-loss-of-precision": "off",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-misused-new": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "off",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-redeclare": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-unnecessary-type-constraint": "off",
"@typescript-eslint/no-unsafe-declaration-merging": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-useless-constructor": "off",
"@typescript-eslint/no-useless-empty-export": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-wrapper-object-types": "off",
"@typescript-eslint/prefer-as-const": "off",
"@typescript-eslint/prefer-enum-initializers": "off",
"@typescript-eslint/prefer-for-of": "off",
"@typescript-eslint/prefer-function-type": "off",
"@typescript-eslint/prefer-literal-enum-member": "off",
"@typescript-eslint/prefer-namespace-keyword": "off",
"@typescript-eslint/prefer-ts-expect-error": "off",
"@typescript-eslint/triple-slash-reference": "off",
"react/button-has-type": "off",
"react/checked-requires-onchange-or-readonly": "off",
"react/iframe-missing-sandbox": "off",
"react/jsx-boolean-value": "off",
"react/jsx-curly-brace-presence": "off",
"react/jsx-key": "off",
"react/jsx-no-comment-textnodes": "off",
"react/jsx-no-duplicate-props": "off",
"react/jsx-no-target-blank": "off",
"react/jsx-no-undef": "off",
"react/jsx-no-useless-fragment": "off",
"react/jsx-props-no-spread-multi": "off",
"react/no-children-prop": "off",
"react/no-danger": "off",
"react/no-danger-with-children": "off",
"react/no-direct-mutation-state": "off",
"react/no-find-dom-node": "off",
"react/no-is-mounted": "off",
"react/no-render-return-value": "off",
"react/no-set-state": "off",
"react/no-string-refs": "off",
"react/no-unescaped-entities": "off",
"react/no-unknown-property": "off",
"react/prefer-es6-class": "off",
"react/react-in-jsx-scope": "off",
"react/require-render-return": "off",
"react/rules-of-hooks": "off",
"react/self-closing-comp": "off",
"react/void-dom-elements-no-children": "off",
"unicorn/catch-error-name": "off",
"unicorn/consistent-function-scoping": "off",
"unicorn/empty-brace-spaces": "off",
"unicorn/error-message": "off",
"unicorn/escape-case": "off",
"unicorn/explicit-length-check": "off",
"unicorn/filename-case": "off",
"unicorn/new-for-builtins": "off",
"unicorn/no-abusive-eslint-disable": "off",
"unicorn/no-anonymous-default-export": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-await-expression-member": "off",
"unicorn/no-await-in-promise-methods": "off",
"unicorn/no-console-spaces": "off",
"unicorn/no-document-cookie": "off",
"unicorn/no-empty-file": "off",
"unicorn/no-hex-escape": "off",
"unicorn/no-instanceof-array": "off",
"unicorn/no-invalid-remove-event-listener": "off",
"unicorn/no-length-as-slice-end": "off",
"unicorn/no-lonely-if": "off",
"unicorn/no-magic-array-flat-depth": "off",
"unicorn/no-negated-condition": "off",
"unicorn/no-negation-in-equality-check": "off",
"unicorn/no-nested-ternary": "off",
"unicorn/no-new-array": "off",
"unicorn/no-new-buffer": "off",
"unicorn/no-null": "off",
"unicorn/no-object-as-default-parameter": "off",
"unicorn/no-process-exit": "off",
"unicorn/no-single-promise-in-promise-methods": "off",
"unicorn/no-static-only-class": "off",
"unicorn/no-thenable": "off",
"unicorn/no-this-assignment": "off",
"unicorn/no-typeof-undefined": "off",
"unicorn/no-unnecessary-await": "off",
"unicorn/no-unreadable-array-destructuring": "off",
"unicorn/no-unreadable-iife": "off",
"unicorn/no-useless-fallback-in-spread": "off",
"unicorn/no-useless-length-check": "off",
"unicorn/no-useless-promise-resolve-reject": "off",
"unicorn/no-useless-spread": "off",
"unicorn/no-useless-switch-case": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/no-zero-fractions": "off",
"unicorn/number-literal-case": "off",
"unicorn/numeric-separators-style": "off",
"unicorn/prefer-add-event-listener": "off",
"unicorn/prefer-array-flat": "off",
"unicorn/prefer-array-flat-map": "off",
"unicorn/prefer-array-some": "off",
"unicorn/prefer-blob-reading-methods": "off",
"unicorn/prefer-code-point": "off",
"unicorn/prefer-date-now": "off",
"unicorn/prefer-dom-node-append": "off",
"unicorn/prefer-dom-node-dataset": "off",
"unicorn/prefer-dom-node-remove": "off",
"unicorn/prefer-dom-node-text-content": "off",
"unicorn/prefer-event-target": "off",
"unicorn/prefer-includes": "off",
"unicorn/prefer-logical-operator-over-ternary": "off",
"unicorn/prefer-math-trunc": "off",
"unicorn/prefer-modern-dom-apis": "off",
"unicorn/prefer-modern-math-apis": "off",
"unicorn/prefer-native-coercion-functions": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-number-properties": "off",
"unicorn/prefer-optional-catch-binding": "off",
"unicorn/prefer-prototype-methods": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/prefer-reflect-apply": "off",
"unicorn/prefer-regexp-test": "off",
"unicorn/prefer-set-size": "off",
"unicorn/prefer-spread": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prefer-string-slice": "off",
"unicorn/prefer-string-starts-ends-with": "off",
"unicorn/prefer-string-trim-start-end": "off",
"unicorn/prefer-structured-clone": "off",
"unicorn/prefer-type-error": "off",
"unicorn/require-array-join-separator": "off",
"unicorn/require-number-to-fixed-digits-argument": "off",
"unicorn/switch-case-braces": "off",
"unicorn/text-encoding-identifier-case": "off",
"unicorn/throw-new-error": "off",
}
`;
Loading

0 comments on commit d65022a

Please sign in to comment.