Skip to content

Instantly share code, notes, and snippets.

@pdehaan
Last active June 1, 2022 17:19
Show Gist options
  • Save pdehaan/c7be43b1989da72d21c90f7a33c7db16 to your computer and use it in GitHub Desktop.
Save pdehaan/c7be43b1989da72d21c90f7a33c7db16 to your computer and use it in GitHub Desktop.
Inspecting the eslint-plugin-* configs for jsx-a11y and react plugins.
const { inspect } = require("node:util");
// `npm i sort-object-keys -D`
const sortObj = require("sort-object-keys");
// `npm i eslint-plugin-jsx-a11y -D`
// console.log(dump("eslint-plugin-jsx-a11y"));
// `npm i eslint-plugin-react -D`
console.log(dump("eslint-plugin-react"));
function dump(plugin) {
const $plugin = require(plugin).configs;
return inspect(sortObj($plugin), { depth: 4 });
}
{
all: {
plugins: [ 'jest' ],
env: { 'jest/globals': true },
rules: {
'jest/consistent-test-it': 'error',
'jest/expect-expect': 'error',
'jest/max-nested-describe': 'error',
'jest/no-alias-methods': 'error',
'jest/no-commented-out-tests': 'error',
'jest/no-conditional-expect': 'error',
'jest/no-conditional-in-test': 'error',
'jest/no-deprecated-functions': 'error',
'jest/no-disabled-tests': 'error',
'jest/no-done-callback': 'error',
'jest/no-duplicate-hooks': 'error',
'jest/no-export': 'error',
'jest/no-focused-tests': 'error',
'jest/no-hooks': 'error',
'jest/no-identical-title': 'error',
'jest/no-interpolation-in-snapshots': 'error',
'jest/no-jasmine-globals': 'error',
'jest/no-jest-import': 'error',
'jest/no-large-snapshots': 'error',
'jest/no-mocks-import': 'error',
'jest/no-restricted-matchers': 'error',
'jest/no-standalone-expect': 'error',
'jest/no-test-prefixes': 'error',
'jest/no-test-return-statement': 'error',
'jest/prefer-called-with': 'error',
'jest/prefer-comparison-matcher': 'error',
'jest/prefer-equality-matcher': 'error',
'jest/prefer-expect-assertions': 'error',
'jest/prefer-expect-resolves': 'error',
'jest/prefer-hooks-in-order': 'error',
'jest/prefer-hooks-on-top': 'error',
'jest/prefer-lowercase-title': 'error',
'jest/prefer-snapshot-hint': 'error',
'jest/prefer-spy-on': 'error',
'jest/prefer-strict-equal': 'error',
'jest/prefer-to-be': 'error',
'jest/prefer-to-contain': 'error',
'jest/prefer-to-have-length': 'error',
'jest/prefer-todo': 'error',
'jest/require-hook': 'error',
'jest/require-to-throw-message': 'error',
'jest/require-top-level-describe': 'error',
'jest/unbound-method': 'error',
'jest/valid-describe-callback': 'error',
'jest/valid-expect-in-promise': 'error',
'jest/valid-expect': 'error',
'jest/valid-title': 'error'
}
},
recommended: {
plugins: [ 'jest' ],
env: { 'jest/globals': true },
rules: {
'jest/expect-expect': 'warn',
'jest/no-commented-out-tests': 'warn',
'jest/no-conditional-expect': 'error',
'jest/no-deprecated-functions': 'error',
'jest/no-disabled-tests': 'warn',
'jest/no-done-callback': 'error',
'jest/no-export': 'error',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/no-interpolation-in-snapshots': 'error',
'jest/no-jasmine-globals': 'error',
'jest/no-jest-import': 'error',
'jest/no-mocks-import': 'error',
'jest/no-standalone-expect': 'error',
'jest/no-test-prefixes': 'error',
'jest/valid-describe-callback': 'error',
'jest/valid-expect-in-promise': 'error',
'jest/valid-expect': 'error',
'jest/valid-title': 'error'
}
},
style: {
plugins: [ 'jest' ],
rules: {
'jest/no-alias-methods': 'warn',
'jest/prefer-to-be': 'error',
'jest/prefer-to-contain': 'error',
'jest/prefer-to-have-length': 'error'
}
}
}
{
recommended: {
plugins: [ 'jsx-a11y' ],
parserOptions: { ecmaFeatures: { jsx: true } },
rules: {
'jsx-a11y/alt-text': 'error',
'jsx-a11y/anchor-has-content': 'error',
'jsx-a11y/anchor-is-valid': 'error',
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
'jsx-a11y/aria-props': 'error',
'jsx-a11y/aria-proptypes': 'error',
'jsx-a11y/aria-role': 'error',
'jsx-a11y/aria-unsupported-elements': 'error',
'jsx-a11y/autocomplete-valid': 'error',
'jsx-a11y/click-events-have-key-events': 'error',
'jsx-a11y/control-has-associated-label': [
'off',
{
ignoreElements: [Array],
ignoreRoles: [Array],
includeRoles: [Array]
}
],
'jsx-a11y/heading-has-content': 'error',
'jsx-a11y/html-has-lang': 'error',
'jsx-a11y/iframe-has-title': 'error',
'jsx-a11y/img-redundant-alt': 'error',
'jsx-a11y/interactive-supports-focus': [ 'error', { tabbable: [Array] } ],
'jsx-a11y/label-has-associated-control': 'error',
'jsx-a11y/label-has-for': 'off',
'jsx-a11y/media-has-caption': 'error',
'jsx-a11y/mouse-events-have-key-events': 'error',
'jsx-a11y/no-access-key': 'error',
'jsx-a11y/no-autofocus': 'error',
'jsx-a11y/no-distracting-elements': 'error',
'jsx-a11y/no-interactive-element-to-noninteractive-role': [ 'error', { tr: [Array], canvas: [Array] } ],
'jsx-a11y/no-noninteractive-element-interactions': [
'error',
{
handlers: [Array],
alert: [Array],
body: [Array],
dialog: [Array],
iframe: [Array],
img: [Array]
}
],
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
'error',
{
ul: [Array],
ol: [Array],
li: [Array],
table: [Array],
td: [Array],
fieldset: [Array]
}
],
'jsx-a11y/no-noninteractive-tabindex': [
'error',
{ tags: [], roles: [Array], allowExpressionValues: true }
],
'jsx-a11y/no-redundant-roles': 'error',
'jsx-a11y/no-static-element-interactions': [ 'error', { allowExpressionValues: true, handlers: [Array] } ],
'jsx-a11y/role-has-required-aria-props': 'error',
'jsx-a11y/role-supports-aria-props': 'error',
'jsx-a11y/scope': 'error',
'jsx-a11y/tabindex-no-positive': 'error'
}
},
strict: {
plugins: [ 'jsx-a11y' ],
parserOptions: { ecmaFeatures: { jsx: true } },
rules: {
'jsx-a11y/alt-text': 'error',
'jsx-a11y/anchor-has-content': 'error',
'jsx-a11y/anchor-is-valid': 'error',
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
'jsx-a11y/aria-props': 'error',
'jsx-a11y/aria-proptypes': 'error',
'jsx-a11y/aria-role': 'error',
'jsx-a11y/aria-unsupported-elements': 'error',
'jsx-a11y/autocomplete-valid': 'error',
'jsx-a11y/click-events-have-key-events': 'error',
'jsx-a11y/control-has-associated-label': [
'off',
{
ignoreElements: [Array],
ignoreRoles: [Array],
includeRoles: [Array]
}
],
'jsx-a11y/heading-has-content': 'error',
'jsx-a11y/html-has-lang': 'error',
'jsx-a11y/iframe-has-title': 'error',
'jsx-a11y/img-redundant-alt': 'error',
'jsx-a11y/interactive-supports-focus': [ 'error', { tabbable: [Array] } ],
'jsx-a11y/label-has-for': 'off',
'jsx-a11y/label-has-associated-control': 'error',
'jsx-a11y/media-has-caption': 'error',
'jsx-a11y/mouse-events-have-key-events': 'error',
'jsx-a11y/no-access-key': 'error',
'jsx-a11y/no-autofocus': 'error',
'jsx-a11y/no-distracting-elements': 'error',
'jsx-a11y/no-interactive-element-to-noninteractive-role': 'error',
'jsx-a11y/no-noninteractive-element-interactions': [ 'error', { body: [Array], iframe: [Array], img: [Array] } ],
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error',
'jsx-a11y/no-noninteractive-tabindex': 'error',
'jsx-a11y/no-redundant-roles': 'error',
'jsx-a11y/no-static-element-interactions': 'error',
'jsx-a11y/role-has-required-aria-props': 'error',
'jsx-a11y/role-supports-aria-props': 'error',
'jsx-a11y/scope': 'error',
'jsx-a11y/tabindex-no-positive': 'error'
}
}
}
{
all: {
plugins: [ 'react' ],
parserOptions: { ecmaFeatures: { jsx: true } },
rules: {
'react/boolean-prop-naming': 2,
'react/button-has-type': 2,
'react/default-props-match-prop-types': 2,
'react/destructuring-assignment': 2,
'react/display-name': 2,
'react/forbid-component-props': 2,
'react/forbid-dom-props': 2,
'react/forbid-elements': 2,
'react/forbid-foreign-prop-types': 2,
'react/forbid-prop-types': 2,
'react/function-component-definition': 2,
'react/hook-use-state': 2,
'react/iframe-missing-sandbox': 2,
'react/jsx-boolean-value': 2,
'react/jsx-child-element-spacing': 2,
'react/jsx-closing-bracket-location': 2,
'react/jsx-closing-tag-location': 2,
'react/jsx-curly-spacing': 2,
'react/jsx-curly-newline': 2,
'react/jsx-equals-spacing': 2,
'react/jsx-filename-extension': 2,
'react/jsx-first-prop-new-line': 2,
'react/jsx-handler-names': 2,
'react/jsx-indent': 2,
'react/jsx-indent-props': 2,
'react/jsx-key': 2,
'react/jsx-max-depth': 2,
'react/jsx-max-props-per-line': 2,
'react/jsx-newline': 2,
'react/jsx-no-bind': 2,
'react/jsx-no-comment-textnodes': 2,
'react/jsx-no-constructed-context-values': 2,
'react/jsx-no-duplicate-props': 2,
'react/jsx-no-leaked-render': 2,
'react/jsx-no-literals': 2,
'react/jsx-no-script-url': 2,
'react/jsx-no-target-blank': 2,
'react/jsx-no-useless-fragment': 2,
'react/jsx-one-expression-per-line': 2,
'react/jsx-no-undef': 2,
'react/jsx-curly-brace-presence': 2,
'react/jsx-pascal-case': 2,
'react/jsx-fragments': 2,
'react/jsx-props-no-multi-spaces': 2,
'react/jsx-props-no-spreading': 2,
'react/jsx-sort-default-props': 2,
'react/jsx-sort-props': 2,
'react/jsx-tag-spacing': 2,
'react/jsx-uses-react': 2,
'react/jsx-uses-vars': 2,
'react/jsx-wrap-multilines': 2,
'react/no-invalid-html-attribute': 2,
'react/no-access-state-in-setstate': 2,
'react/no-adjacent-inline-elements': 2,
'react/no-array-index-key': 2,
'react/no-arrow-function-lifecycle': 2,
'react/no-children-prop': 2,
'react/no-danger': 2,
'react/no-danger-with-children': 2,
'react/no-deprecated': 2,
'react/no-did-mount-set-state': 2,
'react/no-did-update-set-state': 2,
'react/no-direct-mutation-state': 2,
'react/no-find-dom-node': 2,
'react/no-is-mounted': 2,
'react/no-multi-comp': 2,
'react/no-namespace': 2,
'react/no-set-state': 2,
'react/no-string-refs': 2,
'react/no-redundant-should-component-update': 2,
'react/no-render-return-value': 2,
'react/no-this-in-sfc': 2,
'react/no-typos': 2,
'react/no-unescaped-entities': 2,
'react/no-unknown-property': 2,
'react/no-unsafe': 2,
'react/no-unstable-nested-components': 2,
'react/no-unused-class-component-methods': 2,
'react/no-unused-prop-types': 2,
'react/no-unused-state': 2,
'react/no-will-update-set-state': 2,
'react/prefer-es6-class': 2,
'react/prefer-exact-props': 2,
'react/prefer-read-only-props': 2,
'react/prefer-stateless-function': 2,
'react/prop-types': 2,
'react/react-in-jsx-scope': 2,
'react/require-default-props': 2,
'react/require-optimization': 2,
'react/require-render-return': 2,
'react/self-closing-comp': 2,
'react/sort-comp': 2,
'react/sort-prop-types': 2,
'react/state-in-constructor': 2,
'react/static-property-placement': 2,
'react/style-prop-object': 2,
'react/void-dom-elements-no-children': 2
}
},
'jsx-runtime': {
plugins: [ 'react' ],
parserOptions: { ecmaFeatures: { jsx: true }, jsxPragma: null },
rules: { 'react/react-in-jsx-scope': 0, 'react/jsx-uses-react': 0 }
},
recommended: {
plugins: [ 'react' ],
parserOptions: { ecmaFeatures: { jsx: true } },
rules: {
'react/display-name': 2,
'react/jsx-key': 2,
'react/jsx-no-comment-textnodes': 2,
'react/jsx-no-duplicate-props': 2,
'react/jsx-no-target-blank': 2,
'react/jsx-no-undef': 2,
'react/jsx-uses-react': 2,
'react/jsx-uses-vars': 2,
'react/no-children-prop': 2,
'react/no-danger-with-children': 2,
'react/no-deprecated': 2,
'react/no-direct-mutation-state': 2,
'react/no-find-dom-node': 2,
'react/no-is-mounted': 2,
'react/no-render-return-value': 2,
'react/no-string-refs': 2,
'react/no-unescaped-entities': 2,
'react/no-unknown-property': 2,
'react/no-unsafe': 0,
'react/prop-types': 2,
'react/react-in-jsx-scope': 2,
'react/require-render-return': 2
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment