eslint-config-alloy
Version:
AlloyTeam ESLint 规则
66 lines • 5.99 kB
JSON
{
"react/boolean-prop-naming": "布尔值类型的 propTypes 的 name 必须为 is 或 has 开头\n@off 不强制要求写 propTypes",
"react/default-props-match-prop-types": "一个 defaultProps 必须有对应的 propTypes\n@off 不强制要求写 propTypes",
"react/display-name": "组件必须有 displayName 属性\n@off 不强制要求写 displayName",
"react/forbid-component-props": "禁止在自定义组件中使用一些指定的 props\n@off 没必要限制",
"react/forbid-elements": "禁止使用一些指定的 elements\n@off 没必要限制",
"react/forbid-prop-types": "禁止使用一些指定的 propTypes\n@off 不强制要求写 propTypes",
"react/forbid-foreign-prop-types": "禁止直接使用别的组建的 propTypes\n@off 不强制要求写 propTypes",
"react/no-array-index-key": "禁止使用数组的 index 作为 key\n@off 太严格了",
"react/no-children-prop": "禁止使用 children 做 props",
"react/no-danger": "禁止使用 dangerouslySetInnerHTML\n@off 没必要限制",
"react/no-danger-with-children": "禁止在使用了 dangerouslySetInnerHTML 的组建内添加 children",
"react/no-deprecated": "禁止使用已废弃的 api",
"react/no-did-mount-set-state": "禁止在 componentDidMount 里面使用 setState\n@off 同构应用需要在 didMount 里写 setState",
"react/no-did-update-set-state": "禁止在 componentDidUpdate 里面使用 setState",
"react/no-direct-mutation-state": "禁止直接修改 this.state",
"react/no-find-dom-node": "禁止使用 findDOMNode",
"react/no-is-mounted": "禁止使用 isMounted",
"react/no-multi-comp": "禁止在一个文件创建两个组件\n@off 有一个 bug https://github.com/yannickcr/eslint-plugin-react/issues/1181",
"react/no-redundant-should-component-update": "禁止在 PureComponent 中使用 shouldComponentUpdate",
"react/no-render-return-value": "禁止使用 ReactDOM.render 的返回值",
"react/no-set-state": "禁止使用 setState\n@off setState 很常用",
"react/no-typos": "禁止拼写错误",
"react/no-string-refs": "禁止使用字符串 ref",
"react/no-unescaped-entities": "禁止在组件的内部存在未转义的 >, \", ' 或 }",
"react/no-unknown-property": "@fixable 禁止出现 HTML 中的属性,如 class",
"react/no-unused-prop-types": "禁止出现未使用的 propTypes\n@off 不强制要求写 propTypes",
"react/no-unused-state": "定义过的 state 必须使用\n@off 没有官方文档,并且存在很多 bug: https://github.com/yannickcr/eslint-plugin-react/search?q=no-unused-state&type=Issues&utf8=%E2%9C%93",
"react/no-will-update-set-state": "禁止在 componentWillUpdate 中使用 setState",
"react/prefer-es6-class": "必须使用 Class 的形式创建组件",
"react/prefer-stateless-function": "必须使用 pure function\n@off 没必要限制",
"react/prop-types": "组件必须写 propTypes\n@off 不强制要求写 propTypes",
"react/react-in-jsx-scope": "出现 jsx 的地方必须 import React\n@off 已经在 no-undef 中限制了",
"react/require-default-props": "非 required 的 prop 必须有 defaultProps\n@off 不强制要求写 propTypes",
"react/require-optimization": "组件必须有 shouldComponentUpdate\n@off 没必要限制",
"react/require-render-return": "render 方法中必须有返回值",
"react/self-closing-comp": "@fixable 组件内没有 children 时,必须使用自闭和写法\n@off 没必要限制",
"react/sort-comp": "@fixable 组件内方法必须按照一定规则排序",
"react/sort-prop-types": "propTypes 的熟悉必须按照字母排序\n@off 没必要限制",
"react/style-prop-object": "style 属性的取值必须是 object",
"react/void-dom-elements-no-children": "HTML 中的自闭和标签禁止有 children",
"react/jsx-boolean-value": "@fixable 布尔值的属性必须显式的写 someprop={true}\n@off 没必要限制",
"react/jsx-closing-bracket-location": "@fixable 自闭和标签的反尖括号必须与尖括号的那一行对齐",
"react/jsx-closing-tag-location": "@fixable 结束标签必须与开始标签的那一行对齐\n@off 已经在 jsx-indent 中限制了",
"react/jsx-curly-spacing": "@fixable 大括号内前后禁止有空格",
"react/jsx-equals-spacing": "@fixable props 与 value 之间的等号前后禁止有空格",
"react/jsx-filename-extension": "限制文件后缀\n@off 没必要限制",
"react/jsx-first-prop-new-line": "@fixable 第一个 prop 必须得换行\n@off 没必要限制",
"react/jsx-handler-names": "handler 的名称必须是 onXXX 或 handleXXX\n@off 没必要限制",
"react/jsx-indent": "@fixable jsx 的 children 缩进必须为四个空格",
"react/jsx-indent-props": "@fixable jsx 的 props 缩进必须为四个空格",
"react/jsx-key": "数组中的 jsx 必须有 key",
"react/jsx-max-props-per-line": "@fixable 限制每行的 props 数量\n@off 没必要限制",
"react/jsx-no-bind": "jsx 中禁止使用 bind\n@off 太严格了",
"react/jsx-no-comment-textnodes": "禁止在 jsx 中使用像注释的字符串",
"react/jsx-no-duplicate-props": "禁止出现重复的 props",
"react/jsx-no-literals": "禁止在 jsx 中出现字符串\n@off 没必要限制",
"react/jsx-no-target-blank": "禁止使用 target=\"_blank\"\n@off 没必要限制",
"react/jsx-no-undef": "禁止使用未定义的 jsx elemet",
"react/jsx-pascal-case": "禁止使用 pascal 写法的 jsx,比如 <TEST_COMPONENT>",
"react/jsx-sort-props": "@fixable props 必须排好序\n@off 没必要限制",
"react/jsx-tag-spacing": "@fixable jsx 的开始和闭合处禁止有空格",
"react/jsx-uses-react": "jsx 文件必须 import React",
"react/jsx-uses-vars": "定义了的 jsx element 必须使用",
"react/jsx-wrap-multilines": "@fixable 多行的 jsx 必须有括号包起来\n@off 没必要限制"
}