From cceb04adee01bf05f8faaf98e4a388cb9685443f Mon Sep 17 00:00:00 2001 From: MURAKAMI Masahiko Date: Mon, 22 Apr 2024 00:16:14 +0900 Subject: [PATCH] chore: migrate flat config --- .eslintrc.js | 8 -------- .github/workflows/test.yml | 3 ++- eslint.config.js | 14 ++++++++++++++ package-lock.json | 36 +++++++++++++++++++++++++++++------- package.json | 5 ++++- 5 files changed, 49 insertions(+), 17 deletions(-) delete mode 100644 .eslintrc.js create mode 100644 eslint.config.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index ee9e664..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - "env": { - "es6": true, - "node": true, - "commonjs": true - }, - "extends": "eslint:recommended" -}; diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 82fca27..62dff57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [18.x, 20.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -28,6 +28,7 @@ jobs: cache: 'npm' - run: npm ci - run: npm run build --if-present + - run: npm run lint - run: npm test - name: Coveralls GitHub Action uses: coverallsapp/github-action@v2.2.3 diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..68e124d --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,14 @@ +const js = require("@eslint/js"); +const globals = require("globals"); + +module.exports = [ + js.configs.recommended, + { + languageOptions: { + globals: { + ...globals.node, + ...globals.commonjs, + }, + }, + }, +]; diff --git a/package-lock.json b/package-lock.json index a9f6937..f627039 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,9 @@ "estraverse": "5.3.0" }, "devDependencies": { + "@eslint/js": "^9.1.1", "eslint": "9.1.0", + "globals": "^15.0.0", "nyc": "15.1.0", "tap": "16.3.10" } @@ -296,6 +298,15 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/traverse/node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/types": { "version": "7.23.0", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", @@ -1734,12 +1745,15 @@ } }, "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.0.0.tgz", + "integrity": "sha512-m/C/yR4mjO6pXDTm9/R/SpYTAIyaUB4EOzcaaMEl7mds7Mshct9GfejiJNQGjHHbdMPey13Kpu4TMbYi9ex1pw==", "dev": true, "engines": { - "node": ">=4" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/graceful-fs": { @@ -5740,6 +5754,14 @@ "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" + }, + "dependencies": { + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + } } }, "@babel/types": { @@ -6835,9 +6857,9 @@ } }, "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.0.0.tgz", + "integrity": "sha512-m/C/yR4mjO6pXDTm9/R/SpYTAIyaUB4EOzcaaMEl7mds7Mshct9GfejiJNQGjHHbdMPey13Kpu4TMbYi9ex1pw==", "dev": true }, "graceful-fs": { diff --git a/package.json b/package.json index 9737e06..6275696 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "Generator of Google Apps Script entry point function", "main": "index.js", "scripts": { - "test": "eslint index.js && nyc --reporter=lcovonly --reporter=text-summary tap test/*.test.js" + "lint": "eslint index.js", + "test": "nyc --reporter=lcovonly --reporter=text-summary tap test/*.test.js" }, "repository": { "type": "git", @@ -21,7 +22,9 @@ "estraverse": "5.3.0" }, "devDependencies": { + "@eslint/js": "^9.1.1", "eslint": "9.1.0", + "globals": "^15.0.0", "nyc": "15.1.0", "tap": "16.3.10" }