Skip to content

Commit

Permalink
feat: use ignorePatterns in configs instead of .eslintignore
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Apr 7, 2020
1 parent 20ae904 commit 4420a9b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const config = {
'./@typescript-eslint.js',
'plugin:eslint-plugin/recommended'
],
ignorePatterns: ['!.eslintplugin/'],
overrides: [
{ files: ['*.spec.*'], extends: ['./jest.js'] },
{
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,25 @@ Install this package:

#### `.eslintignore`

You can use the `.eslintignore` file used by this repo. It includes relevant files for TypeScript, Ruby, and PHP projects.
The configurations provided in this package specify `ignorePatterns` with common
folders to be ignored as part of best practice, meaning an `.eslintignore` file
is not required.

Projects can use this property themselves instead of an `.eslintignore` to
ignore additional files & folders, using standard ignore-glob syntax:

```js
/** @type {import('eslint').Linter.Config} */
const config = {
extends: ['ackama'],
ignorePatterns: ['!.myFile.js', 'test/fixtures', '!test/fixtures/**.ts']
};

module.exports = config;
```

As `ignorePatterns` is merged across all configs being extended from, you can
use `!` to un-ignore entries.

#### @typescript-eslint

Expand Down
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ const config = {
'plugin:prettier/recommended',
'plugin:eslint-comments/recommended'
],
ignorePatterns: [
'!.eslintrc.js',
'node_modules/',
'coverage/',
'bundle/',
'public/',
'vendor/',
'dist/',
'lib/',
'out/'
],
rules: {
'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
'eslint-comments/no-unused-disable': 'error',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"react.js"
],
"scripts": {
"lint": "eslint . --ignore-pattern '!.eslintrc.js' --ext js,ts",
"lint": "eslint . --ext js,ts",
"release": "semantic-release -r git+ssh://git@github.com/ackama/eslint-config-ackama.git",
"test": "jest",
"typecheck": "tsc --noEmit"
Expand Down Expand Up @@ -88,7 +88,7 @@
"typescript": "^3.8.3"
},
"peerDependencies": {
"eslint": ">= 6",
"eslint": ">= 6.7",
"eslint-plugin-eslint-comments": ">= 3",
"eslint-plugin-prettier": ">= 3.1",
"prettier": ">= 1.19"
Expand Down

0 comments on commit 4420a9b

Please sign in to comment.