Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const supported = `
- react/boolean-prop-naming\tEnforces consistent naming for boolean props
- react/button-has-type\tForbid "button" element without an explicit "type" attribute
- react/default-props-match-prop-types\tEnforce all defaultProps are defined and not "required" in propTypes.
- react/destructuring-assignment\tEnforce consistent usage of destructuring assignment of props, state, and context
- ✔\t\treact/display-name\tPrevent missing displayName in a React component definition
- react/forbid-component-props\tForbid certain props on components
- react/forbid-dom-props\tForbid certain props on DOM Nodes
- react/forbid-elements\tForbid certain elements
- react/forbid-foreign-prop-types\tForbid using another component's propTypes
- react/forbid-prop-types\tForbid certain propTypes
- 🔧\treact/function-component-definition\tStandardize the way function component get defined
- react/hook-use-state\tEnsure symmetric naming of useState hook value and setter variables
- react/iframe-missing-sandbox\tEnforce sandbox attribute on iframe elements
- react/no-access-state-in-setstate\tReports when this.state is accessed within setState
- react/no-adjacent-inline-elements\tPrevent adjacent inline elements not separated by whitespace.
- react/no-array-index-key\tPrevent usage of Array index in keys
- 🔧\treact/no-arrow-function-lifecycle\tLifecycle methods should be methods on the prototype, not class fields
- ✔\t\treact/no-children-prop\tPrevent passing of children as props.
- react/no-danger\tPrevent usage of dangerous JSX props
- ✔\t\treact/no-danger-with-children\tReport when a DOM element is using both children and dangerouslySetInnerHTML
- ✔\t\treact/no-deprecated\tPrevent usage of deprecated methods
- react/no-did-mount-set-state\tPrevent usage of setState in componentDidMount
- react/no-did-update-set-state\tPrevent usage of setState in componentDidUpdate
- ✔\t\treact/no-direct-mutation-state\tPrevent direct mutation of this.state
- ✔\t\treact/no-find-dom-node\tPrevent usage of findDOMNode
- 🔧\treact/no-invalid-html-attribute\tForbid attribute with an invalid values\`
- ✔\t\treact/no-is-mounted\tPrevent usage of isMounted
- react/no-multi-comp\tPrevent multiple component definition per file
- react/no-namespace\tEnforce that namespaces are not used in React elements
- react/no-redundant-should-component-update\tFlag shouldComponentUpdate when extending PureComponent
- ✔\t\treact/no-render-return-value\tPrevent usage of the return value of React.render
- react/no-set-state\tPrevent usage of setState
- ✔\t\treact/no-string-refs\tPrevent string definitions for references and prevent referencing this.refs
- react/no-this-in-sfc\tReport "this" being used in stateless components
- react/no-typos\tPrevent common typos
- ✔\t\treact/no-unescaped-entities\tDetect unescaped HTML entities, which might represent malformed tags
- ✔\t🔧\treact/no-unknown-property\tPrevent usage of unknown DOM property
- react/no-unsafe\tPrevent usage of unsafe lifecycle methods
- react/no-unstable-nested-components\tPrevent creating unstable components inside components
- react/no-unused-class-component-methods\tPrevent declaring unused methods of component class
- react/no-unused-prop-types\tPrevent definitions of unused prop types
- react/no-unused-state\tPrevent definition of unused state fields
- react/no-will-update-set-state\tPrevent usage of setState in componentWillUpdate
- react/prefer-es6-class\tEnforce ES5 or ES6 class for React Components
- react/prefer-exact-props\tPrefer exact proptype definitions
- 🔧\treact/prefer-read-only-props\tRequire read-only props.
- react/prefer-stateless-function\tEnforce stateless components to be written as a pure function
- ✔\t\treact/prop-types\tPrevent missing props validation in a React component definition
- ✔\t\treact/react-in-jsx-scope\tPrevent missing React when using JSX
- react/require-default-props\tEnforce a defaultProps definition for every prop that is not a required prop.
- react/require-optimization\tEnforce React components to have a shouldComponentUpdate method
- ✔\t\treact/require-render-return\tEnforce ES5 or ES6 class for returning value in render function
- 🔧\treact/self-closing-comp\tPrevent extra closing tags for components without children
- react/sort-comp\tEnforce component methods order
- react/sort-prop-types\tEnforce propTypes declarations alphabetical sorting
- react/state-in-constructor\tState initialization in an ES6 class component should be in a constructor
- react/static-property-placement\tDefines where React component static properties should be positioned.
- react/style-prop-object\tEnforce style prop value is an object
- react/void-dom-elements-no-children\tPrevent passing of children to void DOM elements (e.g. <br />).
- `;
- const JSXspecificrule = `
- 🔧\treact/jsx-boolean-value\tEnforce boolean attributes notation in JSX
- react/jsx-child-element-spacing\tEnsures inline tags are not rendered without spaces between them
- 🔧\treact/jsx-closing-bracket-location\tValidate closing bracket location in JSX
- 🔧\treact/jsx-closing-tag-location\tValidate closing tag location for multiline JSX
- 🔧\treact/jsx-curly-brace-presence\tDisallow unnecessary JSX expressions when literals alone are sufficient or enfore JSX expressions on literals in JSX children or attributes
- 🔧\treact/jsx-curly-newline\tEnforce consistent line breaks inside jsx curly
- 🔧\treact/jsx-curly-spacing\tEnforce or disallow spaces inside of curly braces in JSX attributes
- 🔧\treact/jsx-equals-spacing\tDisallow or enforce spaces around equal signs in JSX attributes
- react/jsx-filename-extension\tRestrict file extensions that may contain JSX
- 🔧\treact/jsx-first-prop-new-line\tEnsure proper position of the first property in JSX
- 🔧\treact/jsx-fragments\tEnforce shorthand or standard form for React fragments
- react/jsx-handler-names\tEnforce event handler naming conventions in JSX
- 🔧\treact/jsx-indent\tValidate JSX indentation
- 🔧\treact/jsx-indent-props\tValidate props indentation in JSX
- ✔\t\treact/jsx-key\tReport missing key props in iterators/collection literals
- react/jsx-max-depth\tValidate JSX maximum depth
- 🔧\treact/jsx-max-props-per-line\tLimit maximum of props on a single line in JSX
- 🔧\treact/jsx-newline\tRequire or prevent a new line after jsx elements and expressions.
- react/jsx-no-bind\tPrevents usage of Function.prototype.bind and arrow functions in React component props
- ✔\t\treact/jsx-no-comment-textnodes\tComments inside children section of tag should be placed inside braces
- react/jsx-no-constructed-context-values\tPrevents JSX context provider values from taking values that will cause needless rerenders.
- ✔\t\treact/jsx-no-duplicate-props\tEnforce no duplicate props
- react/jsx-no-literals\tPrevent using string literals in React component definition
- react/jsx-no-script-url\tForbid javascript: URLs
- ✔\t🔧\treact/jsx-no-target-blank\tForbid target="_blank" attribute without rel="noreferrer"
- ✔\t\treact/jsx-no-undef\tDisallow undeclared variables in JSX
- 🔧\treact/jsx-no-useless-fragment\tDisallow unnecessary fragments
- 🔧\treact/jsx-one-expression-per-line\tLimit to one expression per line in JSX
- react/jsx-pascal-case\tEnforce PascalCase for user-defined JSX components
- 🔧\treact/jsx-props-no-multi-spaces\tDisallow multiple spaces between inline JSX props
- react/jsx-props-no-spreading\tPrevent JSX prop spreading
- react/jsx-sort-default-props\tEnforce default props alphabetical sorting
- 🔧\treact/jsx-sort-props\tEnforce props alphabetical sorting
- 🔧\treact/jsx-space-before-closing\tValidate spacing before closing bracket in JSX
- 🔧\treact/jsx-tag-spacing\tValidate whitespace in and around the JSX opening and closing brackets
- ✔\t\treact/jsx-uses-react\tPrevent React to be marked as unused
- ✔\t\treact/jsx-uses-vars\tPrevent variables used in JSX to be marked as unused
- 🔧\treact/jsx-wrap-multilines\tPrevent missing parentheses around multilines JSX
- `;
- const headingForList = {
- supported: {},
- jsx: {},
- };
- JSXspecificrule.split('\n').forEach((l) => {
- if (l) {
- l.trim().split('\t').forEach((c) => {
- if (c.startsWith('react/')) {
- headingForList.jsx[c] = 'Waiting...';
- }
- });
- }
- });
- supported.split('\n').forEach((l) => {
- if (l) {
- l.trim().split('\t').forEach((c) => {
- if (c.startsWith('react/')) {
- headingForList.supported[c] = 'Waiting...';
- }
- });
- }
- });
- const allRules = {
- ...require('./jsx-specific').rules,
- ...require('./supported').rules,
- };
- Object.keys(allRules).forEach((key) => {
- Object.keys(headingForList).forEach((heading) => {
- if (headingForList[heading][key]) {
- headingForList[heading][key] = allRules[key];
- delete allRules[key];
- }
- });
- });
- console.log(JSON.stringify(headingForList, null, 2));
Advertisement
Add Comment
Please, Sign In to add comment