From d0e1b23b658e7e44edc2cb0003e138fce96691fc Mon Sep 17 00:00:00 2001 From: Ryota Kameoka Date: Wed, 9 Feb 2022 19:11:42 +0900 Subject: [PATCH] Add `@herp-inc/eslint-config-jsx` --- README.md | 1 + jsx/CHANGELOG.md | 5 +++++ jsx/README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ jsx/index.js | 9 +++++++++ jsx/package.json | 26 ++++++++++++++++++++++++++ package.json | 1 + 6 files changed, 85 insertions(+) create mode 100644 jsx/CHANGELOG.md create mode 100644 jsx/README.md create mode 100644 jsx/index.js create mode 100644 jsx/package.json diff --git a/README.md b/README.md index db17846..f7efe1b 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ A monorepo for [ESLint shareable configs](https://eslint.org/docs/developer-guid | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | [`@herp-inc/eslint-config`](https://github.com/herp-inc/eslint-config/tree/master/base) | [![npm](https://img.shields.io/npm/v/@herp-inc/eslint-config)](https://www.npmjs.com/package/@herp-inc/eslint-config) | [TypeScript](https://www.typescriptlang.org/) environments | | [`@herp-inc/eslint-config-jest`](https://github.com/herp-inc/eslint-config/tree/master/jest) | [![npm](https://img.shields.io/npm/v/@herp-inc/eslint-config-jest)](https://www.npmjs.com/package/@herp-inc/eslint-config-jest) | [Jest](https://jestjs.io/) environments | +| [`@herp-inc/eslint-config-jsx`](https://github.com/herp-inc/eslint-config/tree/master/jsx) | [![npm](https://img.shields.io/npm/v/@herp-inc/eslint-config-jsx)](https://www.npmjs.com/package/@herp-inc/eslint-config-jsx) | [JSX](https://facebook.github.io/jsx/) environments | | [`@herp-inc/eslint-config-node`](https://github.com/herp-inc/eslint-config/tree/master/node) | [![npm](https://img.shields.io/npm/v/@herp-inc/eslint-config-node)](https://www.npmjs.com/package/@herp-inc/eslint-config-node) | [Node.js](https://nodejs.org/en/) environments | ## Lisence diff --git a/jsx/CHANGELOG.md b/jsx/CHANGELOG.md new file mode 100644 index 0000000..4270735 --- /dev/null +++ b/jsx/CHANGELOG.md @@ -0,0 +1,5 @@ +# Change log + +## v0.1.0 + +- Initial release diff --git a/jsx/README.md b/jsx/README.md new file mode 100644 index 0000000..7b1177f --- /dev/null +++ b/jsx/README.md @@ -0,0 +1,43 @@ +# `@herp-inc/eslint-config-jsx` [![npm](https://img.shields.io/npm/v/@herp-inc/eslint-config-jsx)](https://www.npmjs.com/package/@herp-inc/eslint-config-jsx) + +[ESLint shareable config](https://eslint.org/docs/developer-guide/shareable-configs) for [JSX](https://facebook.github.io/jsx/) environments + +This package is intended to be used along with [`@herp-inc/eslint-config`](https://www.npmjs.com/package/@herp-inc/eslint-config). + +## Installation + +Note that the following packages are peer dependencies of this library, which need to be installed separately. + +| Package | Version | +| -------------------------------------------------------------------------------- | --------- | +| [`eslint`](https://www.npmjs.com/package/eslint) | `8` | +| [`eslint-plugin-jsx-a11y`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) | `^6.5.0` | +| [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react) | `^7.27.0` | + +### Using [npm](https://www.npmjs.com/) + +```sh +$ npm install --save-dev @herp-inc/eslint-config-jsx +``` + +### Using [yarn](https://yarnpkg.com/) + +```sh +$ yarn add --dev @herp-inc/eslint-config-jsx +``` + +## Usage + +Add `@herp-inc/eslint-config-jsx` to the `extends` section of your [ESLint configuration](http://eslint.org/docs/user-guide/configuring). + +```json +{ + "extends": ["@herp-inc"], + "overrides": [ + { + "extends": ["@herp-inc/eslint-config-jsx"], + "files": ["*.tsx"] + } + ] +} +``` diff --git a/jsx/index.js b/jsx/index.js new file mode 100644 index 0000000..9135339 --- /dev/null +++ b/jsx/index.js @@ -0,0 +1,9 @@ +module.exports = { + extends: ['plugin:jsx-a11y/recommended'], + plugins: ['jsx-a11y', 'react'], + rules: { + 'react/button-has-type': 'error', + 'react/jsx-no-comment-textnodes': 'error', + 'react/jsx-no-useless-fragment': 'error', + }, +}; diff --git a/jsx/package.json b/jsx/package.json new file mode 100644 index 0000000..55c53fa --- /dev/null +++ b/jsx/package.json @@ -0,0 +1,26 @@ +{ + "name": "@herp-inc/eslint-config-jsx", + "version": "0.1.0", + "description": "ESLint shareable config for JSX environments", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/herp-inc/eslint-config" + }, + "keywords": [ + "eslint", + "eslintconfig", + "jsx" + ], + "author": "HERP, Inc.", + "license": "MIT", + "bugs": { + "url": "https://github.com/herp-inc/eslint-config/issues" + }, + "homepage": "https://github.com/herp-inc/eslint-config", + "peerDependencies": { + "eslint": "8", + "eslint-plugin-jsx-a11y": "^6.5.0", + "eslint-plugin-react": "^7.27.0" + } +} diff --git a/package.json b/package.json index beb316d..9a10822 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "workspaces": [ "base", "jest", + "jsx", "node" ], "devDependencies": {