{"_id":"@39digits/eslint-config-react","_rev":"3-d7bf76cbba4f1110772d18724d9b8321","name":"@39digits/eslint-config-react","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@39digits/eslint-config-react","version":"1.0.0","description":"An ESLint shareable config for use on React projects including Prettier and optional TypeScript support","main":"index.js","scripts":{"lint":"eslint ."},"keywords":["javascript","typescript","eslint","eslintconfig","lint","config","prettier"],"author":{"name":"Christopher Hamilton"},"repository":{"type":"git","url":"git://github.com/39digits/eslint-config-react.git"},"bugs":{"url":"https://github.com/39digits/eslint-config-react/issues"},"license":"MIT","devDependencies":{"babel-eslint":"^10.1.0","eslint":"^7.5.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.22.0","eslint-plugin-react":"^7.20.4","eslint-plugin-react-hooks":"^4.0.8","prettier":"^2.0.5"},"peerDependencies":{"babel-eslint":">= 10.1.0","eslint":">= 7.5.0","eslint-config-prettier":">= 6.11.0","eslint-plugin-import":">= 2.22.0","eslint-plugin-react":">= 7.20.4","eslint-plugin-react-hooks":">= 4.0.8","prettier":">= 2.0.5"},"optionalPeerDependencies":{"@typescript-eslint/eslint-plugin":">= 3.7.0","@typescript-eslint/parser":">= 3.7.0","typescript":">= 3.9.7"},"gitHead":"ce80ed1bec1e017f352731158a741ef4575c372a","homepage":"https://github.com/39digits/eslint-config-react#readme","_id":"@39digits/eslint-config-react@1.0.0","_nodeVersion":"14.3.0","_npmVersion":"6.14.5","dist":{"integrity":"sha512-9VlQ/k+gHwakNPxAkqOmms1ymzslL67FFAxTo+XPhH045dUqYH9pDf5uRG+nq8WhEqz6ZtMYte8ZM9ASirTDaA==","shasum":"31437ced8a473852136b22e9dd6418f5234bf88c","tarball":"https://registry.npmjs.org/@39digits/eslint-config-react/-/eslint-config-react-1.0.0.tgz","fileCount":8,"unpackedSize":11073,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIdNqCRA9TVsSAnZWagAAYDMP/2OL97MNQsN3i+pUYJRF\nmopmQMBxgdGhgoIMOmeWPYVziPLMUoZRjcIBaQs/vy7cyvrCULWdZ9tKcLB2\n3I3Z6eKB+kpVyHTuoF2/hac+MaJquLyV6fLj4/aHDvj4P1derUfeSuNidPNV\nlNY7x6WUGZP4Fdd89O0KJ/cxS09/2qo+RCnaMdK/uoGnn/astQ9+BmcLs+Fl\n32LSwAZGu0zl7E5ihW++obMdQl0Mynl7j5UOrrAe3z5maeJNVAlvAi5HmAz5\nGFYXILIv8EOweHgRvOErGJlj9nBKiOQMP1bA/BkH1Y6ZHoz65+7zSRAkOrpd\n8W5KqLt2OCAh0esD9gMqmeGcl1dYETuOG+IVG81iGwphKGlN+V5eDYyiwVg9\npxDYDobwYWsAGE4IsJE+RBzj6kUZrE+1sZLcwephFZXNkQIatSS/oQBd4bPp\nKf1k1aIw5f9VdYdwfTq6lcaUqu23HowKM0RbS6ngL0cLhmlVN4NcP+3lE3QA\nkpVM2BU18JAgtd9anmel6XoVvDetyrsvBSoYgT52S7MrSdl1W+yOm9DijzK6\n2xSzZSScQ/xjuiH6LyI7O3r0eyaoom8Q6ZdHbnRwnW6bW53yN/y3zMd98+yk\ntDWA8lCiIvt18rLOBCgOkIxQGc6EN9144EAsxF3aZnizy3azDy5PkhdYAF6F\nlNk0\r\n=GTL1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6ZN5V4gjqObzTzqK4ZvPmE5QGuhGHgdaj/R1PSpFtDwIhAJ5ZsEb4r3d7ALi9Q/Hg36MpHLhcPfcEVjJlhpoQIf06"}]},"maintainers":[{"name":"39digits","email":"christopher@39digits.com"}],"_npmUser":{"name":"39digits","email":"christopher@39digits.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-config-react_1.0.0_1596052329921_0.5514156455283052"},"_hasShrinkwrap":false},"1.0.1":{"name":"@39digits/eslint-config-react","version":"1.0.1","description":"An ESLint shareable config for use on React projects including Prettier and optional TypeScript support","main":"index.js","scripts":{"lint":"eslint ."},"keywords":["javascript","typescript","eslint","eslintconfig","lint","config","prettier"],"author":{"name":"Christopher Hamilton"},"repository":{"type":"git","url":"git://github.com/39digits/eslint-config-react.git"},"bugs":{"url":"https://github.com/39digits/eslint-config-react/issues"},"license":"MIT","devDependencies":{"babel-eslint":"^10.1.0","eslint":"^7.5.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.22.0","eslint-plugin-react":"^7.20.4","eslint-plugin-react-hooks":"^4.0.8","prettier":"^2.0.5"},"peerDependencies":{"babel-eslint":">= 10.1.0","eslint":">= 7.5.0","eslint-config-prettier":">= 6.11.0","eslint-plugin-import":">= 2.22.0","eslint-plugin-react":">= 7.20.4","eslint-plugin-react-hooks":">= 4.0.8","prettier":">= 2.0.5"},"optionalPeerDependencies":{"@typescript-eslint/eslint-plugin":">= 3.7.0","@typescript-eslint/parser":">= 3.7.0","typescript":">= 3.9.7"},"gitHead":"996d66bde1387b25c4a85cda6b2ec2c3bbf0421d","homepage":"https://github.com/39digits/eslint-config-react#readme","_id":"@39digits/eslint-config-react@1.0.1","_nodeVersion":"14.3.0","_npmVersion":"6.14.5","dist":{"integrity":"sha512-kkuAB3cuCLC5RIrlF9QhYPyaFR3w7+y/SU+RbSHFz1rUNEdHVfe8t+eUNYlkgNNRVrO2c/Oz4Zpb9GPZpE9+yA==","shasum":"702ba5e8f48ebd235dbaa5377dc3827cd612b53a","tarball":"https://registry.npmjs.org/@39digits/eslint-config-react/-/eslint-config-react-1.0.1.tgz","fileCount":8,"unpackedSize":11079,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIdcrCRA9TVsSAnZWagAA0gcP/1G1FLaQaR5kZMOP82ln\nboKgqqx0F8a/iVt+tLfWuk6LpscxjMe5RqxhpYzS2nJn/RlKJTOjgtxLRVtA\nM3lmPboUg6BDdaUkriqLwIf4618R9iCTwqsMLnn9JYQsUs2WqoBViYnYqAa1\nf6avrQXDSplfuTHt6Mi0Bg99eZNuq+YU83wdgmc13QFuDGcqL4yF8jXlp3q5\ntzKhLIc5DaL2myksG32ietM5wRc7lMjqt7MS56O8+6nhru00fjj5/UEN3MqU\ntpOqb1BCFVGafyUZmWaP5UchhP/w053vmEuYJmEmI8YbZUb2vcpea0eqSqzn\nZR8N5Etj9i+uLxl9KIEdQ0EJ/TZ/AjoGikSmlu5W8wRd97/zQi7ECM/Bl/5i\ngNIms/19V5wsl2Ou/SKfKQt4wEUcC5DQO/pjNWV2RE5IktHKbi8tQDh/YOh1\nP6I6rYSLzovaPT5cXF+OU+YolaJ4PL/XLHEneHdf9fZML9Nmu9rymG59ueVB\nCCbo8lBFG5Y5oTZmGjN5DBb8JACPxND6fcN7S6zP/hAu/m/UB2aQu3DPHAo8\nbrx6JO6qkpufwK663a1K39eCI6CbTVfpaRB3SVV47C2Ircugi27uFT2rW4Kq\nK5v9U8ENhvqje3hfTH/8utq6NNjNg5oOsm4UsgGcLGwpIekRHLMXfslS8f1q\nsx/o\r\n=LOym\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC9pa33PggMVwl2p27DJRQI316cRXNKhC0X4M1KsoBXRQIhAIUkk3mgtfDB7SBGO7/aTrH3XxkT8sogSy2hRwyMhpLX"}]},"maintainers":[{"name":"39digits","email":"christopher@39digits.com"}],"_npmUser":{"name":"39digits","email":"christopher@39digits.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-config-react_1.0.1_1596053290638_0.4623814996184583"},"_hasShrinkwrap":false},"1.0.2":{"name":"@39digits/eslint-config-react","version":"1.0.2","description":"An ESLint shareable config for use on React projects including Prettier and optional TypeScript support","main":"index.js","scripts":{"lint":"eslint ."},"keywords":["javascript","typescript","eslint","eslintconfig","lint","config","prettier"],"author":{"name":"Christopher Hamilton"},"repository":{"type":"git","url":"git://github.com/39digits/eslint-config-react.git"},"bugs":{"url":"https://github.com/39digits/eslint-config-react/issues"},"license":"MIT","devDependencies":{"babel-eslint":"^10.1.0","eslint":"^7.5.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.22.0","eslint-plugin-react":"^7.20.4","eslint-plugin-react-hooks":"^4.0.8","prettier":"^2.0.5"},"peerDependencies":{"babel-eslint":">= 10.1.0","eslint":">= 7.5.0","eslint-config-prettier":">= 6.11.0","eslint-plugin-import":">= 2.22.0","eslint-plugin-react":">= 7.20.4","eslint-plugin-react-hooks":">= 4.0.8","prettier":">= 2.0.5"},"optionalPeerDependencies":{"@typescript-eslint/eslint-plugin":">= 3.7.0","@typescript-eslint/parser":">= 3.7.0","typescript":">= 3.9.7"},"gitHead":"6a3c976ecddf89bc004ff2022dab578067043353","homepage":"https://github.com/39digits/eslint-config-react#readme","_id":"@39digits/eslint-config-react@1.0.2","_nodeVersion":"16.2.0","_npmVersion":"7.13.0","dist":{"integrity":"sha512-zq156kTz7/yEittMaKikjAV3Cg2Q2Gau2WX5tAnjNA2JgXtsyZirtdTAhjXW0+1RXtrPn5sbljnUo2UOwAS9og==","shasum":"966fb0194b64ce436acc0ec1b603ba88a6721984","tarball":"https://registry.npmjs.org/@39digits/eslint-config-react/-/eslint-config-react-1.0.2.tgz","fileCount":8,"unpackedSize":11079,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgxKZ0CRA9TVsSAnZWagAAXd4QAJssU/mh0jwpjtwn078e\nn4pK3+pRhlqjSZwIoe2xIb81l59SJx+u8Wi2mGINlWbg1PlpZQF4zi0g6IN6\n8uSVN3e9zrl3nlxnQpfr5ZZigHcbVMqq4luTaUJN+LNDiSd2k6lthMRkzDxq\nZQBmxjZgBIBOdmDL9Stszaxk+kCfAqAQmj1RFliZaUlXlQlXmfe9V22qI+Sk\nqpXHU0cGLFR0d4CJ7IwfjyHoqcfPkC7w3wm420vtrSBUr11dhrqHTjARnBBZ\nKqgyODd4e7GzBlHqz9O21lpa/6SAf8WDo7letCPIY5CKu+qH0EYlfkfaUf9Z\nB6B+vEGRFUJ5x2w+ZOoXGQxmL2a3v9q5Kd8Tj2PdxVhsyzgEY+W8YyfBJbZ+\nDHrWzq8vJylvLY3rFe1tczCPcD3bwwPiYq7VYxi41n7etM6brdV/iPJytB9f\nKFegH2GFz4kv6ZvWRyoDTX0bw+4Lqc2+J3C8ATUMS245DX4fbTpWPgvvB2yg\n7QsVV+4SjLV1ztEzZXzf2OD93KAG2rGL/K/gftA2Kq43I04FrGnfvh/eoAZk\nG4P8URgz15sG9ekasBzUqQfBaT6593an+F828GmB/aqXUu9Y2A49UiTZ9RC4\neKWSTYjb4d4AvKNWIDaCtMjgsQPffgLetIB9cvBi//3iMnnYTwOylPiPODsg\necRZ\r\n=JMfd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCPj2S7KclMW4FiXnabBWgj40/Ao0yDb0HJqV0k554lqAIhAKZNMvcGX//jOfz4lEqL5d4Q+I1j23h6cCJCtMJbRt1D"}]},"_npmUser":{"name":"39digits","email":"christopher@39digits.com"},"directories":{},"maintainers":[{"name":"39digits","email":"christopher@39digits.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-config-react_1.0.2_1623500403824_0.48782668759887327"},"_hasShrinkwrap":false}},"time":{"created":"2020-07-29T19:52:09.880Z","1.0.0":"2020-07-29T19:52:10.031Z","modified":"2022-04-04T10:44:27.341Z","1.0.1":"2020-07-29T20:08:10.833Z","1.0.2":"2021-06-12T12:20:04.026Z"},"maintainers":[{"name":"39digits","email":"christopher@39digits.com"}],"description":"An ESLint shareable config for use on React projects including Prettier and optional TypeScript support","homepage":"https://github.com/39digits/eslint-config-react#readme","keywords":["javascript","typescript","eslint","eslintconfig","lint","config","prettier"],"repository":{"type":"git","url":"git://github.com/39digits/eslint-config-react.git"},"author":{"name":"Christopher Hamilton"},"bugs":{"url":"https://github.com/39digits/eslint-config-react/issues"},"license":"MIT","readme":"# ESLint config for React with Prettier and TypeScript support\n\n## Quick-start\n\n### Installation\n\nEither use [install-peerdeps](https://www.npmjs.com/package/install-peerdeps) via _npx_ to install this shareable config and its peer dependencies automatically.\n\n```shell\nnpx install-peerdeps --dev @39digits/eslint-config-react\n```\n\nOr explicitly install everything in one line using _npm_.\n\n```shell\nnpm install --save-dev eslint babel-eslint @39digits/eslint-config-react eslint-config-prettier eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks prettier\n```\n\n### Usage\n\nNow create a `.eslintrc.js` configuration file in your project root and add `@39digits/eslint-config-react` to the `extends` field. Add any extra rules you want to use under the `rules` section.\n\n```\n{\n  \"extends\": [\"@39digits/eslint-config-react\"],\n  \"rules\": {\n    // ...\n  }\n}\n```\n\nCreate a `.prettierrc` configuration file in your project root and populate with your [preferred formatting preferences](https://prettier.io/docs/en/options.html).\n\nMy personal preferences are as follows.\n\n```shell\n{\n  \"singleQuote\": true,\n  \"semi\": true,\n  \"useTabs\": false\n}\n```\n\nIf you like the Prettier defaults, simply leave the config object empty.\n\n### A note on Prettier usage\n\nMy shareable config only uses the ESLint Prettier Config and does not make use of the ESLint Prettier Plugin. This is the recommended method of [integrating Prettier with your linter](https://prettier.io/docs/en/integrating-with-linters.html).\n\nThe Prettier Config will turn off any ESLint rules that should only be handled by Prettier itself. This ensures ESlint focuses on checking code quality; Prettier to format it.\n\nMany shareable configs that use the Prettier Plugin will set Prettier preferences as actual linting rules. I don't feel comfortable hiding these settings from the project view and instead rely on an easily discoverable `.prettierrc` configuration file with explicit rules in the project root.\n\n# Enabling Typescript Support\n\n### Installation\n\nI did not include the TypeScript modules in the _peerDependencies_ of `package.json` to avoid npm complaining on projects that won't use TypeScript at all. You will need to install the dependencies manually.\n\n```shell\nnpm install --save-dev typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin\n```\n\n**Note:** Install these packages in addition to the main shareable config packages.\n\nYou may also wish to install some types while you're at it - these will change depending on your project's requirements.\n\n```shell\nnpm install --save-dev @types/react @types/node\n```\n\n### Usage\n\n#### Separate Linting for JavaScript and TypeScript files\n\nI prefer using the TypeScript parser and TypeScript linting rules on `*.ts` or `*.tsx` files only. I then leave the JavaScript linting to `babel-eslint`.\n\nTo achieve this we can use ESLint's `overrides` feature. This ensures the TypeScript linting rules do not, for example, complain about no return type on a function inside of a `*.js` file.\n\nThere is one caveat in that any project specific `rules` do not cascade. Any rules defined in our local `.eslintrc.js` file needs to be replicated within the `overrides` section. I recommend setting any local rules within a variable and then applying that to each section to avoid unnecessary duplication and bugs.\n\n```js\n// .eslintrc.js\nconst commonRules = {\n  // Example rule...\n  'prefer-const': 'error',\n};\n\nmodule.exports = {\n  extends: ['@39digits/eslint-config-react'],\n  rules: commonRules,\n  overrides: [\n    {\n      files: ['**/*.ts', '**/*.tsx'],\n      extends: ['@39digits/eslint-config-react/typescript'],\n      rules: commonRules,\n    },\n  ],\n};\n```\n\n#### TypeScript All The Things!\n\nOther times you may want to run everything through `@typescript-eslint/parser` and the TypeScript linting rules.\n\n```js\n// .eslintrc.js\nmodule.exports = {\n  extends: ['@39digits/eslint-config-react/typescript'],\n  rules: {\n    // ...\n  },\n};\n```\n\n# Setup Visual Studio Code\n\nInstall the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) Visual Studio Code extensions.\n\nAdd the following to your Visual Studio Code `settings.json` preferences file.\n\n```\n{\n  // When you save a file it will run any formatters (i.e. Prettier)\n  \"editor.formatOnSave\": true,\n  // Ensure the Prettier extension is used as the default formatter\n  \"[javascript]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  // This requires a .prettierrc file in the project root.\n  // If there is no config file then Prettier will not run.\n  // This is useful if you work on projects not (yet) using Prettier\n  // to avoid huge commits existing of largely formatting changes\n  // Reference: https://github.com/prettier/prettier-vscode#prettierrequireconfig-default-false\n  \"prettier.requireConfig\": true\n}\n```\n\nNow Prettier will automatically format your code when you save any supported file. ESLint will also now show visual indicators for any code not adhering to your rules.\n\nHappy coding!\n\n## License\n\n[MIT](LICENSE).\n","readmeFilename":"README.md"}