UNPKG

canonical

Version:

Canonical code style linter and formatter for JavaScript, SCSS and CSS.

76 lines (75 loc) 11.6 kB
{ "_args": [ [ "eslint-plugin-react@https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-3.14.0.tgz", "/Users/gajus/Documents/dev/canonical-code-style/canonical" ] ], "_from": "eslint-plugin-react@>=3.11.1 <4.0.0", "_id": "eslint-plugin-react@3.14.0", "_inCache": true, "_location": "/eslint-plugin-react", "_phantomChildren": {}, "_requested": { "name": "eslint-plugin-react", "raw": "eslint-plugin-react@https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-3.14.0.tgz", "rawSpec": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-3.14.0.tgz", "scope": null, "spec": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-3.14.0.tgz", "type": "remote" }, "_requiredBy": [ "/eslint-config-canonical-react" ], "_resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-3.14.0.tgz", "_shasum": "54763adfd33838b31c822088f774d3a2ad85daff", "_shrinkwrap": null, "_spec": "eslint-plugin-react@https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-3.14.0.tgz", "_where": "/Users/gajus/Documents/dev/canonical-code-style/canonical", "author": { "email": "yannick.croissant+npm@gmail.com", "name": "Yannick Croissant" }, "bugs": { "url": "https://github.com/yannickcr/eslint-plugin-react/issues" }, "dependencies": {}, "description": "React specific linting rules for ESLint", "devDependencies": { "babel-eslint": "5.0.0-beta6", "coveralls": "2.11.6", "eslint": "2.0.0-alpha-2", "istanbul": "0.4.1", "mocha": "2.3.4" }, "files": [ "LICENSE", "README.md", "index.js", "lib" ], "homepage": "https://github.com/yannickcr/eslint-plugin-react", "keywords": [ "eslint", "eslint-plugin", "eslintplugin", "react" ], "license": "MIT", "main": "index.js", "name": "eslint-plugin-react", "optionalDependencies": {}, "readme": "ESLint-plugin-React\n===================\n\n[![Maintenance Status][status-image]][status-url] [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Build Status][appveyor-image]][appveyor-url] [![Dependency Status][deps-image]][deps-url] [![Coverage Status][coverage-image]][coverage-url] [![Code Climate][climate-image]][climate-url]\n\nReact specific linting rules for ESLint\n\n# Installation\n\nInstall [ESLint](https://www.github.com/eslint/eslint) either locally or globally.\n\n```sh\n$ npm install eslint\n```\n\nIf you installed `ESLint` globally, you have to install React plugin globally too. Otherwise, install it locally.\n\n```sh\n$ npm install eslint-plugin-react\n```\n\n# Configuration\n\nAdd `plugins` section and specify ESLint-plugin-React as a plugin.\n\n```json\n{\n \"plugins\": [\n \"react\"\n ]\n}\n```\n\nYou can also specify some settings that will be shared across all the plugin rules.\n\n```js\n{\n \"settings\": {\n \"react\": {\n \"pragma\": \"React\" // Pragma to use, default to \"React\"\n }\n }\n}\n```\n\nIf it is not already the case you must also configure `ESLint` to support JSX.\n\nWith ESLint 1.x.x:\n\n```json\n{\n \"ecmaFeatures\": {\n \"jsx\": true\n }\n}\n```\n\nWith ESLint 2.x.x:\n\n```json\n{\n \"parserOptions\": {\n \"ecmaFeatures\": {\n \"jsx\": true\n }\n }\n}\n```\n\nFinally, enable all of the rules that you would like to use.\n\n```json\n{\n \"rules\": {\n \"react/display-name\": 1,\n \"react/forbid-prop-types\": 1,\n \"react/jsx-boolean-value\": 1,\n \"react/jsx-closing-bracket-location\": 1,\n \"react/jsx-curly-spacing\": 1,\n \"react/jsx-handler-names\": 1,\n \"react/jsx-indent-props\": 1,\n \"react/jsx-indent\": 1,\n \"react/jsx-key\": 1,\n \"react/jsx-max-props-per-line\": 1,\n \"react/jsx-no-bind\": 1,\n \"react/jsx-no-duplicate-props\": 1,\n \"react/jsx-no-literals\": 1,\n \"react/jsx-no-undef\": 1,\n \"react/jsx-pascal-case\": 1,\n \"react/jsx-quotes\": 1,\n \"react/jsx-sort-prop-types\": 1,\n \"react/jsx-sort-props\": 1,\n \"react/jsx-uses-react\": 1,\n \"react/jsx-uses-vars\": 1,\n \"react/no-danger\": 1,\n \"react/no-deprecated\": 1,\n \"react/no-did-mount-set-state\": 1,\n \"react/no-did-update-set-state\": 1,\n \"react/no-direct-mutation-state\": 1,\n \"react/no-is-mounted\": 1,\n \"react/no-multi-comp\": 1,\n \"react/no-set-state\": 1,\n \"react/no-string-refs\": 1,\n \"react/no-unknown-property\": 1,\n \"react/prefer-es6-class\": 1,\n \"react/prop-types\": 1,\n \"react/react-in-jsx-scope\": 1,\n \"react/require-extension\": 1,\n \"react/self-closing-comp\": 1,\n \"react/sort-comp\": 1,\n \"react/wrap-multilines\": 1\n }\n}\n```\n\n# List of supported rules\n\n* [display-name](docs/rules/display-name.md): Prevent missing `displayName` in a React component definition\n* [forbid-prop-types](docs/rules/forbid-prop-types.md): Forbid certain propTypes\n* [jsx-boolean-value](docs/rules/jsx-boolean-value.md): Enforce boolean attributes notation in JSX\n* [jsx-closing-bracket-location](docs/rules/jsx-closing-bracket-location.md): Validate closing bracket location in JSX\n* [jsx-curly-spacing](docs/rules/jsx-curly-spacing.md): Enforce or disallow spaces inside of curly braces in JSX attributes\n* [jsx-handler-names](docs/rules/jsx-handler-names.md): Enforce event handler naming conventions in JSX\n* [jsx-indent-props](docs/rules/jsx-indent-props.md): Validate props indentation in JSX\n* [jsx-indent](docs/rules/jsx-indent.md): Validate JSX indentation\n* [jsx-key](docs/rules/jsx-key.md): Validate JSX has key prop when in array or iterator\n* [jsx-max-props-per-line](docs/rules/jsx-max-props-per-line.md): Limit maximum of props on a single line in JSX\n* [jsx-no-bind](docs/rules/jsx-no-bind.md): Prevent usage of `.bind()` and arrow functions in JSX props\n* [jsx-no-duplicate-props](docs/rules/jsx-no-duplicate-props.md): Prevent duplicate props in JSX\n* [jsx-no-literals](docs/rules/jsx-no-literals.md): Prevent usage of unwrapped JSX strings\n* [jsx-no-undef](docs/rules/jsx-no-undef.md): Disallow undeclared variables in JSX\n* [jsx-pascal-case](docs/rules/jsx-pascal-case.md): Enforce PascalCase for user-defined JSX components\n* [jsx-quotes](docs/rules/jsx-quotes.md): Enforce quote style for JSX attributes\n* [jsx-sort-prop-types](docs/rules/jsx-sort-prop-types.md): Enforce propTypes declarations alphabetical sorting\n* [jsx-sort-props](docs/rules/jsx-sort-props.md): Enforce props alphabetical sorting\n* [jsx-uses-react](docs/rules/jsx-uses-react.md): Prevent React to be incorrectly marked as unused\n* [jsx-uses-vars](docs/rules/jsx-uses-vars.md): Prevent variables used in JSX to be incorrectly marked as unused\n* [no-danger](docs/rules/no-danger.md): Prevent usage of dangerous JSX properties\n* [no-deprecated](docs/rules/no-deprecated.md): Prevent usage of deprecated methods\n* [no-did-mount-set-state](docs/rules/no-did-mount-set-state.md): Prevent usage of `setState` in `componentDidMount`\n* [no-did-update-set-state](docs/rules/no-did-update-set-state.md): Prevent usage of `setState` in `componentDidUpdate`\n* [no-direct-mutation-state](docs/rules/no-direct-mutation-state.md): Prevent direct mutation of `this.state`\n* [no-is-mounted](docs/rules/no-is-mounted.md): Prevent usage of `isMounted`\n* [no-multi-comp](docs/rules/no-multi-comp.md): Prevent multiple component definition per file\n* [no-set-state](docs/rules/no-set-state.md): Prevent usage of `setState`\n* [no-string-refs](docs/rules/no-string-refs.md): Prevent using string references in `ref` attribute.\n* [no-unknown-property](docs/rules/no-unknown-property.md): Prevent usage of unknown DOM property\n* [prefer-es6-class](docs/rules/prefer-es6-class.md): Enforce ES5 or ES6 class for React Components\n* [prop-types](docs/rules/prop-types.md): Prevent missing props validation in a React component definition\n* [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent missing `React` when using JSX\n* [require-extension](docs/rules/require-extension.md): Restrict file extensions that may be required\n* [self-closing-comp](docs/rules/self-closing-comp.md): Prevent extra closing tags for components without children\n* [sort-comp](docs/rules/sort-comp.md): Enforce component methods order\n* [wrap-multilines](docs/rules/wrap-multilines.md): Prevent missing parentheses around multilines JSX\n\n## React Native\n\nIf you're searching for React Native specific linting rules, check out [eslint-plugin-react-native](https://github.com/Intellicode/eslint-plugin-react-native).\n\n# License\n\nESLint-plugin-React is licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php).\n\n\n[npm-url]: https://npmjs.org/package/eslint-plugin-react\n[npm-image]: https://img.shields.io/npm/v/eslint-plugin-react.svg\n\n[travis-url]: https://travis-ci.org/yannickcr/eslint-plugin-react\n[travis-image]: https://img.shields.io/travis/yannickcr/eslint-plugin-react/master.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSItMTQyLjUgLTE0Mi41IDI4NSAyODUiPjxjaXJjbGUgcj0iMTQxLjciIGZpbGw9IiNERDQ4MTQiLz48ZyBpZD0iYSIgZmlsbD0iI0ZGRiI%2BPGNpcmNsZSBjeD0iLTk2LjQiIHI9IjE4LjkiLz48cGF0aCBkPSJNLTQ1LjYgNjguNGMtMTYuNi0xMS0yOS0yOC0zNC00Ny44IDYtNSA5LjgtMTIuMyA5LjgtMjAuNnMtMy44LTE1LjctOS44LTIwLjZjNS0xOS44IDE3LjQtMzYuNyAzNC00Ny44bDEzLjggMjMuMkMtNDYtMzUuMi01NS4zLTE4LjctNTUuMyAwYzAgMTguNyA5LjMgMzUuMiAyMy41IDQ1LjJ6Ii8%2BPC9nPjx1c2UgeGxpbms6aHJlZj0iI2EiIHRyYW5zZm9ybT0icm90YXRlKDEyMCkiLz48dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSgyNDApIi8%2BPC9zdmc%2B\n\n[appveyor-url]: https://ci.appveyor.com/project/yannickcr/eslint-plugin-react\n[appveyor-image]: https://img.shields.io/appveyor/ci/yannickcr/eslint-plugin-react/master.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjEyOCIgaGVpZ2h0PSIxMjgiIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48ZyBmaWxsPSIjMUJBMUUyIiB0cmFuc2Zvcm09InNjYWxlKDgpIj48cGF0aCBkPSJNMCAyLjI2NWw2LjUzOS0uODg4LjAwMyA2LjI4OC02LjUzNi4wMzd6Ii8%2BPHBhdGggZD0iTTYuNTM2IDguMzlsLjAwNSA2LjI5My02LjUzNi0uODk2di01LjQ0eiIvPjxwYXRoIGQ9Ik03LjMyOCAxLjI2MWw4LjY3LTEuMjYxdjcuNTg1bC04LjY3LjA2OXoiLz48cGF0aCBkPSJNMTYgOC40NDlsLS4wMDIgNy41NTEtOC42Ny0xLjIyLS4wMTItNi4zNDV6Ii8%2BPC9nPjwvc3ZnPg==\n\n[deps-url]: https://david-dm.org/yannickcr/eslint-plugin-react\n[deps-image]: https://img.shields.io/david/dev/yannickcr/eslint-plugin-react.svg\n\n[coverage-url]: https://coveralls.io/r/yannickcr/eslint-plugin-react?branch=master\n[coverage-image]: https://img.shields.io/coveralls/yannickcr/eslint-plugin-react/master.svg\n\n[climate-url]: https://codeclimate.com/github/yannickcr/eslint-plugin-react\n[climate-image]: https://img.shields.io/codeclimate/github/yannickcr/eslint-plugin-react.svg\n\n[status-url]: https://github.com/yannickcr/eslint-plugin-react/pulse\n[status-image]: https://img.shields.io/badge/status-maintained-brightgreen.svg\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/yannickcr/eslint-plugin-react.git" }, "scripts": { "coveralls": "cat ./reports/coverage/lcov.info | coveralls", "lint": "eslint ./", "test": "npm run lint && npm run unit-test", "unit-test": "istanbul cover --dir reports/coverage node_modules/mocha/bin/_mocha tests/**/*.js -- --reporter dot" }, "version": "3.14.0" }