Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to ESLint 9 compatible version of eslint-find-rules #72

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
node-version:
- 16
- 18
steps:
- name: Clone repository
uses: actions/checkout@v2
Expand Down
84 changes: 41 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
## Install

```sh
npm install eslint@8 eslint-config-nitpick --save-dev
npm install eslint@9 eslint-config-nitpick --save-dev
```

## Usage

Add this config to your `.eslintrc`:
Add this config to your `eslint.config.js`:

<!-- prettier-ignore-start -->

```json
{
"extends": [
"eslint-config-nitpick"
]
}
```js
import configNitpick from 'eslint-config-nitpick';

export default [
configNitpick
];
```

<!-- prettier-ignore-end -->
Expand All @@ -31,34 +31,34 @@ preset:**

<!-- prettier-ignore-start -->

```json
{
"extends": [
"eslint-config-nitpick",
"eslint-config-nitpick/other-preset"
]
}
```js
import configNitpick from 'eslint-config-nitpick';
import configPreset from 'eslint-config-nitpick/other-preset';

export default [
configNitpick,
configPreset
];
```

<!-- prettier-ignore-end -->

## Presets

In addition to default preset, there are also specific presets. You can apply
multiple presets with [ESLint `extends` option][eslint-extends].
In addition to default preset, there are also specific presets.

### Browser

Browser specific rules.

<!-- prettier-ignore-start -->

```json
{
"extends": [
"eslint-config-nitpick/browser"
]
}
```js
import configBrowser from 'eslint-config-nitpick/browser';

export default [
configBrowser
];
```

<!-- prettier-ignore-end -->
Expand All @@ -69,12 +69,12 @@ Rules for testing frameworks (e.g. Mocha).

<!-- prettier-ignore-start -->

```json
{
"extends": [
"eslint-config-nitpick/tests"
]
}
```js
import configTest from 'eslint-config-nitpick/tests';

export default [
configTest
];
```

<!-- prettier-ignore-end -->
Expand All @@ -85,12 +85,12 @@ Vue specific rules.

<!-- prettier-ignore-start -->

```json
{
"extends": [
"eslint-config-nitpick/vue"
]
}
```js
import configVue from 'eslint-config-nitpick/vue';

export default [
...configVue
];
```

<!-- prettier-ignore-end -->
Expand All @@ -101,12 +101,12 @@ TypeScript specific rules.

<!-- prettier-ignore-start -->

```json
{
"extends": [
"eslint-config-nitpick/typescript"
]
}
```js
import configTypescript from 'eslint-config-nitpick/typescript';

export default [
configTypescript
];
```

<!-- prettier-ignore-end -->
Expand All @@ -120,7 +120,5 @@ MIT © [Ivan Nikolić](http://ivannikolic.com)
[ci]: https://github.com/niksy/eslint-config-nitpick/actions?query=workflow%3ACI
[ci-img]: https://github.com/niksy/eslint-config-nitpick/workflows/CI/badge.svg?branch=master
[eslint]: http://eslint.org/
[eslint-extends]: http://eslint.org/docs/user-guide/configuring#extending-configuration-files
[tc39-proposals]: https://github.com/tc39/proposals#active-proposals

<!-- prettier-ignore-end -->
16 changes: 10 additions & 6 deletions browser.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
'use strict';
import globals from 'globals';
import pluginUnicorn from 'eslint-plugin-unicorn';

module.exports = {
env: {
node: false,
browser: true
export default {
languageOptions: {
globals: {
...globals.browser
}
},
plugins: {
unicorn: pluginUnicorn
},
plugins: ['eslint-plugin-unicorn'],
rules: {
'no-console': 2,
'no-implicit-globals': 2,
Expand Down
59 changes: 59 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import configPrettier from 'eslint-config-prettier';
import pluginPrettier from 'eslint-plugin-prettier';
import pluginUnicorn from 'eslint-plugin-unicorn';
import pluginImport from 'eslint-plugin-import';
import configTest from './tests.js';
import configBase from './index.js';

export default [
configBase,
configPrettier,
{
plugins: {
prettier: pluginPrettier,
unicorn: pluginUnicorn,
import: pluginImport
},
'rules': {
'prettier/prettier': 1,
'unicorn/prefer-module': 0,
'import/no-commonjs': 0
}
},
{
'files': ['*.js'],
plugins: {
unicorn: pluginUnicorn
},
'rules': {
'unicorn/prevent-abbreviations': [
1,
{
'allowList': {
'env': true,
'props': true,
'prev': true,
'ignoreRefs': true
}
}
]
}
},
{
...configTest,
'files': ['test/**'],
plugins: {
...configTest.plugins,
unicorn: pluginUnicorn,
import: pluginImport
},
'rules': {
...configTest.rules,
'unicorn/prefer-module': 2,
'import/no-commonjs': 2
}
},
{
ignores: ['**/test/fixtures/*.config.*']
}
];
42 changes: 24 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
'use strict';
import globals from 'globals';
import pluginPromise from 'eslint-plugin-promise';
import pluginNode from 'eslint-plugin-n';
import pluginUnicorn from 'eslint-plugin-unicorn';
import pluginJsdoc from 'eslint-plugin-jsdoc';
import pluginImport from 'eslint-plugin-import';

module.exports = {
env: {
node: true,
es2022: true
},
parserOptions: {
export default {
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module'
sourceType: 'module',
globals: {
...globals.node,
...globals.es2022
}
},
plugins: {
promise: pluginPromise,
n: pluginNode,
unicorn: pluginUnicorn,
jsdoc: pluginJsdoc,
import: pluginImport
},
plugins: [
'eslint-plugin-promise',
'eslint-plugin-n',
'eslint-plugin-unicorn',
'eslint-plugin-jsdoc',
'eslint-plugin-import'
],
rules: {
'n/no-sync': 1,
'n/no-restricted-require': 0,
Expand Down Expand Up @@ -267,7 +272,6 @@
'no-unexpected-multiline': 2,
'no-unreachable': 2,
'use-isnan': 2,
'valid-jsdoc': 0,
'valid-typeof': 2,
'no-unsafe-finally': 1,
'no-unsafe-negation': 2,
Expand Down Expand Up @@ -445,7 +449,6 @@
}
],
'operator-assignment': 0,
'require-jsdoc': 0,
'sort-keys': 0,
'sort-vars': 0,
'line-comment-position': 0,
Expand Down Expand Up @@ -599,7 +602,7 @@
],
'comma-style': [2, 'last'],
'computed-property-spacing': [2, 'never'],
'dot-location': [1, 'property'],

Check warning on line 605 in index.js

View workflow job for this annotation

GitHub Actions / Test (18)

File has too many lines (808). Maximum allowed is 600

Check warning on line 605 in index.js

View workflow job for this annotation

GitHub Actions / Test (18)

File has too many lines (808). Maximum allowed is 600
'eol-last': [2, 'unix'],
'func-call-spacing': [2, 'never'],
'function-call-argument-newline': 0,
Expand Down Expand Up @@ -807,6 +810,9 @@
'template-tag-spacing': [2, 'never'],
'wrap-iife': [2, 'inside'],
'wrap-regex': 0,
'yield-star-spacing': [1, 'after']
'yield-star-spacing': [1, 'after'],
'jsdoc/check-template-names': 0,
'jsdoc/convert-to-jsdoc-comments': 0,
'jsdoc/require-template': 0
}
};
Loading
Loading