Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ryota-ka committed May 18, 2020
0 parents commit 6d83bcf
Show file tree
Hide file tree
Showing 15 changed files with 829 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Build
on: push
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run Prettier
run: npx prettier --check .
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
yarn-error.log
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all"
}
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# eslint-config

A monorepo for [ESLint shareable configs](https://eslint.org/docs/developer-guide/shareable-configs)

## Packages

| Package | Version | Target |
| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| [`@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-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

MIT
37 changes: 37 additions & 0 deletions base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# `@herp-inc/eslint-config` [![npm](https://img.shields.io/npm/v/@herp-inc/eslint-config)](https://www.npmjs.com/package/@herp-inc/eslint-config)

[ESLint shareable config](https://eslint.org/docs/developer-guide/shareable-configs) for general [TypeScript](https://www.typescriptlang.org/) environments

## Installation

Note that the following packages are peer dependencies of this library, which need to be installed separately.

| Package | Version |
| ---------------------------------------------------------------------------------------------------- | --------- |
| [`@typescript-eslint/eslint-plugin`](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) | `^2.28.0` |
| [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser) | `^2.18.0` |
| [`eslint`](https://www.npmjs.com/package/eslint) | `7` |
| [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier) | `*` |
| [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-config-import) | `^2.20.0` |

### Using [npm](https://www.npmjs.com/)

```sh
$ npm install --save-dev @herp-inc/eslint-config
```

### Using [yarn](https://yarnpkg.com/)

```sh
$ yarn install --save-dev @herp-inc/eslint-config
```

## Usage

Add `@herp-inc` to the `extends` section of your [ESLint configuration](http://eslint.org/docs/user-guide/configuring).

```json
{
"extends": ["@herp-inc"]
}
```
103 changes: 103 additions & 0 deletions base/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/typescript',
'prettier',
],
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/explicit-function-return-type': [
'error',
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
},
],
'@typescript-eslint/explicit-member-accessibility': 'error',
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-throw-literal': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/strict-boolean-expressions': 'error',
},
},
],
plugins: ['import'],
rules: {
// ESlint core
curly: 'error',
'default-case-last': 'error',
eqeqeq: 'error',
'no-console': 'error',
'no-duplicate-imports': 'error',
'no-else-return': ['error', { allowElseIf: false }],
'no-lonely-if': 'error',
'no-mixed-operators': 'error',
'no-multi-assign': 'error',
'no-negated-condition': 'error',
'no-new': 'error',
'no-new-object': 'error',
'no-new-wrappers': 'error',
'no-param-reassign': 'error',
'no-return-assign': 'error',
'no-return-await': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-underscore-dangle': 'error',
'no-unmodified-loop-condition': 'error',
'no-unneeded-ternary': 'error',
'no-useless-backreference': 'error',
'no-useless-concat': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'prefer-const': 'error',
'prefer-object-spread': 'error',
'sort-imports': [
'error',
{
ignoreCase: true,
ignoreDeclarationSort: true,
},
],

// import
'import/first': 'error',
'import/no-default-export': 'error',
'import/no-deprecated': 'error',
'import/no-mutable-exports': 'error',
'import/no-unassigned-import': 'error',
'import/no-useless-path-segments': ['error', { noUselessIndex: true }],
'import/order': [
'error',
{
alphabetize: { caseInsensitive: true, order: 'asc' },
groups: [['builtin', 'external'], 'parent', ['sibling', 'index']],
'newlines-between': 'always',
},
],
},
};
28 changes: 28 additions & 0 deletions base/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@herp-inc/eslint-config",
"version": "0.1.0",
"description": "ESLint shareable config for TypeScript environments",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/herp-inc/eslint-config"
},
"keywords": [
"eslint",
"eslintconfig",
"typescript"
],
"author": "HERP, Inc.",
"license": "MIT",
"bugs": {
"url": "https://github.com/herp-inc/eslint-config/issues"
},
"homepage": "https://github.com/herp-inc/eslint-config",
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^2.28.0",
"@typescript-eslint/parser": "^2.18.0",
"eslint": "7",
"eslint-config-prettier": "*",
"eslint-plugin-import": "^2.20.0"
}
}
42 changes: 42 additions & 0 deletions jest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# `@herp-inc/eslint-config-jest` [![npm](https://img.shields.io/npm/v/@herp-inc/eslint-config-jest)](https://www.npmjs.com/package/@herp-inc/eslint-config-jest)

[ESLint shareable config](https://eslint.org/docs/developer-guide/shareable-configs) for [Jest](https://jestjs.io/) 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) | `7` |
| [`eslint-config-jest`](https://www.npmjs.com/package/eslint-config-jest) | `23` |

### Using [npm](https://www.npmjs.com/)

```sh
$ npm install --save-dev @herp-inc/eslint-config-jest
```

### Using [yarn](https://yarnpkg.com/)

```sh
$ yarn install --save-dev @herp-inc/eslint-config-jest
```

## Usage

Add `@herp-inc/eslint-config-jest` 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-jest"],
"files": ["*.test.ts"]
}
]
}
```
22 changes: 22 additions & 0 deletions jest/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
env: {
node: true,
},
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
plugins: ['jest'],
rules: {
'jest/expect-expect': 'error',
'jest/no-alias-methods': 'error',
'jest/no-commented-out-tests': 'error',
'jest/no-disabled-tests': 'error',
'jest/no-duplicate-hooks': 'error',
'jest/no-expect-resolves': 'error',
'jest/no-if': 'error',
'jest/no-jasmine-globals': 'error',
'jest/no-test-return-statement': 'error',
'jest/no-truthy-falsy': 'error',
'jest/require-to-throw-message': 'error',
'jest/require-top-level-describe': 'error',
'jest/valid-title': ['error', { ignoreTypeOfDescribeName: true }],
},
};
25 changes: 25 additions & 0 deletions jest/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@herp-inc/eslint-config-jest",
"version": "0.1.0",
"description": "ESLint shareable config for Jest environments",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/herp-inc/eslint-config"
},
"keywords": [
"eslint",
"eslintconfig",
"jest"
],
"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": "7",
"eslint-plugin-jest": "23"
}
}
36 changes: 36 additions & 0 deletions node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# `@herp-inc/eslint-config-node` [![npm](https://img.shields.io/npm/v/@herp-inc/eslint-config-node)](https://www.npmjs.com/package/@herp-inc/eslint-config-node)

[ESLint shareable config](https://eslint.org/docs/developer-guide/shareable-configs) for [Node.js](https://nodejs.org/en/) 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) | `7` |
| [`eslint-config-node`](https://www.npmjs.com/package/eslint-config-node) | `11` |

### Using [npm](https://www.npmjs.com/)

```sh
$ npm install --save-dev @herp-inc/eslint-config-node
```

### Using [yarn](https://yarnpkg.com/)

```sh
$ yarn install --save-dev @herp-inc/eslint-config
```

## Usage

Add `@herp-inc/eslint-config-node` to the `extends` section of your [ESLint configuration](http://eslint.org/docs/user-guide/configuring).

```json
{
"extends": ["@herp-inc", "@herp-inc/eslint-config-node"]
}
```
23 changes: 23 additions & 0 deletions node/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
env: {
node: true,
},
extends: ['plugin:node/recommended'],
plugins: ['node'],
rules: {
'node/global-require': 'error',
'node/no-path-concat': 'error',
'node/no-process-exit': 'error',
'node/no-sync': 'error',
'node/no-unsupported-features/es-syntax': ['error', { ignores: ['modules'] }],
'node/prefer-global/buffer': 'error',
'node/prefer-global/console': 'error',
'node/prefer-global/process': 'error',
'node/prefer-global/text-decoder': 'error',
'node/prefer-global/text-encoder': 'error',
'node/prefer-global/url': 'error',
'node/prefer-global/url-search-params': 'error',
'node/prefer-promises/dns': 'error',
'node/prefer-promises/fs': 'error',
},
};
26 changes: 26 additions & 0 deletions node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@herp-inc/eslint-config-node",
"version": "0.1.0",
"description": "ESLint shareable config for Node.js environments",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/herp-inc/eslint-config"
},
"keywords": [
"eslint",
"eslintconfig",
"node",
"nodejs"
],
"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": "7",
"eslint-plugin-node": "11"
}
}
Loading

0 comments on commit 6d83bcf

Please sign in to comment.