diff --git a/eslintrc.json b/.eslintrc.json similarity index 95% rename from eslintrc.json rename to .eslintrc.json index 5b30b020..5d6c3317 100644 --- a/eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,6 @@ { "parserOptions": { - "ecmaVersion": 2021, + "ecmaVersion": 2022, "ecmaFeatures": { "jsx": true }, @@ -14,7 +14,7 @@ "plugins": [ "import", - "node", + "n", "promise" ], @@ -26,6 +26,7 @@ "rules": { "no-var": "warn", + "object-shorthand": ["warn", "properties"], "accessor-pairs": ["error", { "setWithoutGet": true, "enforceForClassMembers": true }], "array-bracket-spacing": ["error", "never"], @@ -134,7 +135,7 @@ "no-mixed-spaces-and-tabs": "error", "no-multi-spaces": "error", "no-multi-str": "error", - "no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0 }], + "no-multiple-empty-lines": ["error", { "max": 1, "maxBOF": 0, "maxEOF": 0 }], "no-new": "error", "no-new-func": "error", "no-new-object": "error", @@ -230,13 +231,13 @@ "import/no-named-default": "error", "import/no-webpack-loader-syntax": "error", - "node/handle-callback-err": ["error", "^(err|error)$" ], - "node/no-callback-literal": "error", - "node/no-deprecated-api": "error", - "node/no-exports-assign": "error", - "node/no-new-require": "error", - "node/no-path-concat": "error", - "node/process-exit-as-throw": "error", + "n/handle-callback-err": ["error", "^(err|error)$" ], + "n/no-callback-literal": "error", + "n/no-deprecated-api": "error", + "n/no-exports-assign": "error", + "n/no-new-require": "error", + "n/no-path-concat": "error", + "n/process-exit-as-throw": "error", "promise/param-names": "error" } diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..1f74277f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + labels: + - "dependency" + # Always increase the version requirement to match the new version. + versioning-strategy: increase + + - package-ecosystem: "github-actions" + directory: "/" + ignore: + - dependency-name: "actions/*" + update-types: + ["version-update:semver-minor", "version-update:semver-patch"] + schedule: + interval: "monthly" + labels: + - "github-actions" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b0fd5fad --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: 'ci' + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + ci: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/checkout@v3' + + - name: 'Use Node.js' + uses: 'actions/setup-node@v3' + with: + node-version: 'lts/*' + + - name: 'Cache Node dependencies' + uses: 'actions/cache@v3.0.1' + with: + path: '~/.npm' + key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: 'Install dependencies' + run: 'npm install' + + - name: 'Run tests' + run: 'npm test' diff --git a/.npmignore b/.npmignore index fcfb6839..b69a701e 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,2 @@ -.travis.yml +.github/ test/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c159f6ac..00000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - lts/* diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f4292dc..e1a60f01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ # Change Log All notable changes to this project will be documented in the -[`standard` CHANGELOG](https://github.com/feross/standard/blob/master/CHANGELOG.md). +[`standard` CHANGELOG](https://github.com/standard/standard/blob/master/CHANGELOG.md). This project's -[commit log](https://github.com/feross/eslint-config-standard/commits/master) is +[commit log](https://github.com/standard/eslint-config-standard/commits/master) is also quite readable. This project adheres to [Semantic Versioning](http://semver.org/). diff --git a/README.md b/README.md index 5b627151..f1877038 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# eslint-config-standard [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] +# eslint-config-standard [![CI][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] -[travis-image]: https://img.shields.io/travis/standard/eslint-config-standard/master.svg -[travis-url]: https://travis-ci.org/standard/eslint-config-standard +[ci-image]: https://github.com/standard/eslint-config-standard/actions/workflows/ci.yml/badge.svg?branch=master +[ci-url]: https://github.com/standard/eslint-config-standard/actions/workflows/ci.yml [npm-image]: https://img.shields.io/npm/v/eslint-config-standard.svg [npm-url]: https://npmjs.org/package/eslint-config-standard [downloads-image]: https://img.shields.io/npm/dm/eslint-config-standard.svg @@ -41,7 +41,7 @@ The above steps will automatically set up an ESLint configuration and install th **If you want to set up the config manually**, run the following command: ```bash -npm install --save-dev eslint-config-standard eslint-plugin-promise eslint-plugin-import eslint-plugin-node +npm install --save-dev eslint-config-standard eslint-plugin-promise eslint-plugin-import eslint-plugin-n ``` Then, add this to your `.eslintrc` file: diff --git a/index.js b/index.js index 68396b3e..7a7acc7d 100644 --- a/index.js +++ b/index.js @@ -1,2 +1,2 @@ /*! eslint-config-standard. MIT License. Feross Aboukhadijeh */ -module.exports = require('./eslintrc.json') +module.exports = require('./.eslintrc.json') diff --git a/package.json b/package.json index d437ff62..3081c2d4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "eslint-config-standard", "description": "JavaScript Standard Style - ESLint Shareable Config", - "version": "16.0.3", + "version": "17.1.0", "author": { "name": "Feross Aboukhadijeh", "email": "feross@feross.org", @@ -10,12 +10,17 @@ "bugs": { "url": "https://github.com/standard/eslint-config-standard/issues" }, + "engines": { + "node": ">=12.0.0" + }, "devDependencies": { - "eslint": "^7.12.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.2.1", - "tape": "^5.0.1" + "@types/eslint": "^8.4.1", + "@types/tape": "^4.13.2", + "eslint": "^8.13.0", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-n": "^16.0.0", + "eslint-plugin-promise": "^6.0.0", + "tape": "^5.5.2" }, "homepage": "https://github.com/standard/eslint-config-standard", "keywords": [ @@ -47,17 +52,17 @@ "license": "MIT", "main": "index.js", "peerDependencies": { - "eslint": "^7.12.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.2.1 || ^5.0.0" + "eslint": "^8.0.1", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", + "eslint-plugin-promise": "^6.0.0" }, "repository": { "type": "git", "url": "git://github.com/standard/eslint-config-standard.git" }, "scripts": { - "lint": "eslint . --config=eslintrc.json", + "lint": "eslint .", "test": "npm run lint && tape test/*.js" }, "funding": [ diff --git a/test/validate-config.js b/test/validate-config.js index 665973ac..34b6a431 100644 --- a/test/validate-config.js +++ b/test/validate-config.js @@ -1,16 +1,18 @@ -const eslint = require('eslint') +const { ESLint } = require('eslint') const test = require('tape') -test('load config in eslint to validate all rule syntax is correct', function (t) { - const CLIEngine = eslint.CLIEngine - - const cli = new CLIEngine({ - useEslintrc: false, - configFile: 'eslintrc.json' - }) - +test('load config in eslint to validate all rule syntax is correct', async function (t) { + const eslint = new ESLint() const code = 'const foo = 1\nconst bar = function () {}\nbar(foo)\n' + const [lintResult] = await eslint.lintText(code) + t.equal(lintResult.errorCount, 0) + t.end() +}) - t.equal(cli.executeOnText(code).errorCount, 0) +test('ensure we allow top level await', async function (t) { + const eslint = new ESLint() + const code = 'const foo = await 1\nconst bar = function () {}\nawait bar(foo)\n' + const [lintResult] = await eslint.lintText(code) + t.equal(lintResult.errorCount, 0) t.end() })