diff --git a/.eslintrc.json b/.eslintrc.json index 90c6790..ba1a2fc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,7 +2,7 @@ "env": { "node": true }, - "extends": "airbnb-base", + "extends": ["airbnb-base", "plugin:prettier/recommended"], "overrides": [ { diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..534e6d3 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + singleQuote: true, +}; diff --git a/index.js b/index.js index 31efaaa..bd6a52b 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ +/* eslint-disable prettier/prettier */ const { readFileSync, writeFileSync, lstatSync } = require('fs'); const { join } = require('path'); const importCwd = require('import-cwd'); diff --git a/package.json b/package.json index a088e0f..169c0ec 100644 --- a/package.json +++ b/package.json @@ -20,13 +20,18 @@ "chai": "^4.3.4", "eslint": "^7.32.0", "eslint-config-airbnb-base": "^14.2.1", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.25.2", + "eslint-plugin-prettier": "^5.2.1", "execa": "^6.0.0", "find-up": "^6.3.0", "fixturify": "^2.1.1", "import-meta-resolve": "^2.1.0", + "lint-to-the-future": "^2.1.0", + "lint-to-the-future-eslint": "file:.", "mocha": "^9.1.3", "pkg-up": "^4.0.0", + "prettier": "^3.3.3", "release-it": "^14.11.6", "temp": "^0.9.4" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 68d83b3..b27354b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,14 +6,19 @@ specifiers: chai: ^4.3.4 eslint: ^7.32.0 eslint-config-airbnb-base: ^14.2.1 + eslint-config-prettier: ^9.1.0 eslint-plugin-import: ^2.25.2 + eslint-plugin-prettier: ^5.2.1 execa: ^6.0.0 find-up: ^6.3.0 fixturify: ^2.1.1 import-cwd: ^3.0.0 import-meta-resolve: ^2.1.0 + lint-to-the-future: ^2.1.0 + lint-to-the-future-eslint: file:. mocha: ^9.1.3 pkg-up: ^4.0.0 + prettier: ^3.3.3 release-it: ^14.11.6 semver: ^7.3.5 temp: ^0.9.4 @@ -30,13 +35,18 @@ devDependencies: chai: 4.5.0 eslint: 7.32.0 eslint-config-airbnb-base: 14.2.1_dhdy5llj4gyo4twxbjovg2n5ie + eslint-config-prettier: 9.1.0_eslint@7.32.0 eslint-plugin-import: 2.30.0_eslint@7.32.0 + eslint-plugin-prettier: 5.2.1_zixntmo2qrnxugqr6g7h5zypva execa: 6.1.0 find-up: 6.3.0 fixturify: 2.1.1 import-meta-resolve: 2.2.2 + lint-to-the-future: 2.1.0 + lint-to-the-future-eslint: file:_eslint@7.32.0 mocha: 9.2.2 pkg-up: 4.0.0 + prettier: 3.3.3 release-it: 14.14.3 temp: 0.9.4 @@ -438,6 +448,11 @@ packages: '@octokit/openapi-types': 12.11.0 dev: true + /@pkgr/core/0.1.1: + resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + dev: true + /@rtsao/scc/1.1.0: resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} dev: true @@ -995,6 +1010,11 @@ packages: delayed-stream: 1.0.0 dev: true + /commander/9.5.0: + resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} + engines: {node: ^12.20.0 || >=14} + dev: true + /concat-map/0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -1440,6 +1460,15 @@ packages: object.entries: 1.1.8 dev: true + /eslint-config-prettier/9.1.0_eslint@7.32.0: + resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + dependencies: + eslint: 7.32.0 + dev: true + /eslint-import-resolver-node/0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} dependencies: @@ -1513,6 +1542,27 @@ packages: - supports-color dev: true + /eslint-plugin-prettier/5.2.1_zixntmo2qrnxugqr6g7h5zypva: + resolution: {integrity: sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + '@types/eslint': '>=8.0.0' + eslint: '>=8.0.0' + eslint-config-prettier: '*' + prettier: '>=3.0.0' + peerDependenciesMeta: + '@types/eslint': + optional: true + eslint-config-prettier: + optional: true + dependencies: + eslint: 7.32.0 + eslint-config-prettier: 9.1.0_eslint@7.32.0 + prettier: 3.3.3 + prettier-linter-helpers: 1.0.0 + synckit: 0.9.1 + dev: true + /eslint-scope/5.1.1: resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} engines: {node: '>=8.0.0'} @@ -1689,6 +1739,10 @@ packages: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} dev: true + /fast-diff/1.3.0: + resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} + dev: true + /fast-glob/3.3.2: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} @@ -1810,6 +1864,15 @@ packages: mime-types: 2.1.35 dev: true + /fs-extra/7.0.1: + resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} + engines: {node: '>=6 <7 || >=8'} + dependencies: + graceful-fs: 4.2.11 + jsonfile: 4.0.0 + universalify: 0.1.2 + dev: true + /fs-extra/8.1.0: resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} engines: {node: '>=6 <7 || >=8'} @@ -2653,6 +2716,20 @@ packages: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} dev: true + /lint-to-the-future/2.1.0: + resolution: {integrity: sha512-Z7TSnsd2XEml9KcNMghFOnHZ1WqL3xHhuZzw20FPC6kR7yFTQtsAVj7/tVhIkgpRYSvWaH/E+bebPXxN/4jCVw==} + engines: {node: 10.* || >= 12} + hasBin: true + dependencies: + chai: 4.5.0 + commander: 9.5.0 + fs-extra: 7.0.1 + import-cwd: 3.0.0 + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + dev: true + /locate-path/6.0.0: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} @@ -3227,6 +3304,19 @@ packages: engines: {node: '>=4'} dev: true + /prettier-linter-helpers/1.0.0: + resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} + engines: {node: '>=6.0.0'} + dependencies: + fast-diff: 1.3.0 + dev: true + + /prettier/3.3.3: + resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} + engines: {node: '>=14'} + hasBin: true + dev: true + /progress/2.0.3: resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} engines: {node: '>=0.4.0'} @@ -3824,6 +3914,14 @@ packages: engines: {node: '>= 0.4'} dev: true + /synckit/0.9.1: + resolution: {integrity: sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==} + engines: {node: ^14.18.0 || >=16.0.0} + dependencies: + '@pkgr/core': 0.1.1 + tslib: 2.7.0 + dev: true + /table/6.8.2: resolution: {integrity: sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA==} engines: {node: '>=10.0.0'} @@ -4104,7 +4202,6 @@ packages: ensure-posix-path: 1.1.1 matcher-collection: 2.0.1 minimatch: 3.1.2 - dev: false /wcwidth/1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} @@ -4270,3 +4367,18 @@ packages: resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==} engines: {node: '>=12.20'} dev: true + + file:_eslint@7.32.0: + resolution: {directory: '', type: directory} + id: 'file:' + name: lint-to-the-future-eslint + version: 2.0.1 + engines: {node: 10.* || >= 12.*} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + eslint: 7.32.0 + import-cwd: 3.0.0 + semver: 7.6.3 + walk-sync: 3.0.0 + dev: true diff --git a/test/fixtures/list/index.js b/test/fixtures/list/index.js index 01b8003..6121bc2 100644 --- a/test/fixtures/list/index.js +++ b/test/fixtures/list/index.js @@ -1,6 +1,4 @@ /* eslint-disable no-unused-vars, prefer-const, quotes, semi */ -let unused = "face"; +let unused = 'face'; -let b = () => { - -} +let b = () => {}; diff --git a/test/fixtures/list/next-line-ignore.js b/test/fixtures/list/next-line-ignore.js index 274881e..ffbde8c 100644 --- a/test/fixtures/list/next-line-ignore.js +++ b/test/fixtures/list/next-line-ignore.js @@ -1,7 +1,5 @@ /* eslint-disable no-unused-vars, quotes, semi */ -const unused = "face"; +const unused = 'face'; // eslint-disable-next-line prefer-const -let b = () => { - -} +let b = () => {}; diff --git a/test/ignore.mjs b/test/ignore.mjs index 3455f60..a4548a5 100644 --- a/test/ignore.mjs +++ b/test/ignore.mjs @@ -1,3 +1,4 @@ +/* eslint-disable prettier/prettier */ import { expect } from 'chai'; import temp from 'temp'; import fixturify from 'fixturify'; diff --git a/test/list.mjs b/test/list.mjs index 5df2002..48cca36 100644 --- a/test/list.mjs +++ b/test/list.mjs @@ -1,3 +1,4 @@ +/* eslint-disable prettier/prettier */ import { expect } from 'chai'; // eslint-disable-next-line import/extensions