From 510354054f63e203f357a66e945e8057f46aabf2 Mon Sep 17 00:00:00 2001 From: Jack Franklin Date: Thu, 7 May 2020 14:54:33 +0100 Subject: [PATCH] chore: add command to run eslint with `--fix` flag (#5829) --- CONTRIBUTING.md | 4 ++-- package.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77200b8a..e4d0d531 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,8 +64,8 @@ information on using pull requests. ## Code Style -- Coding style is fully defined in [`.eslintrc`](https://github.com/puppeteer/puppeteer/blob/master/.eslintrc.js). -- We are migrating the Puppeteer codebase to TypeScript which is why you'll find both JS and TS files in `src/`. +- Coding style is fully defined in [`.eslintrc`](https://github.com/puppeteer/puppeteer/blob/master/.eslintrc.js) and we automatically format our code with [Prettier](https://prettier.io). +- It's recommended to set-up Prettier into your editor, or you can run `npm run eslint-fix` to automatically format any files. - If you're working in a JS file, code should be annotated with [closure annotations](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler). - If you're working in a TS file, you should explicitly type all variables and return types. You'll get ESLint warnings if you don't so if you're not sure use them as guidelines, and feel free to ask us for help! diff --git a/package.json b/package.json index c7f38b05..0546bfbf 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "dev-install": "npm run tsc && node install.js", "install": "node install.js", "eslint": "([ \"$CI\" = true ] && eslint --ext js --ext ts --quiet -f codeframe . || eslint --ext js --ext ts .)", + "eslint-fix": "eslint --ext js --ext ts --fix .", "lint": "npm run eslint && npm run tsc && npm run doc", "doc": "node utils/doclint/cli.js", "tsc": "tsc --version && tsc -p . && cp src/protocol.d.ts lib/",