cf3a34a9b4
* Convert action to ts - Add optional header support - Add optional body support * Small fixes to action.yml and action output * Add node_modules until bundler is added * Add node-fetch * Remove fetch, add axios * Update build * Fix issue with res.status being undefined * Update logging for debug purposes * Attempt to fix missing status code output * Attempt to have code wait for request to finish * Prepare for release - Final cleanup * Allow optional headers & body * v2.0.0 * Add support for environment variables (fixed #17) (#19) * v2.0.0 (#12) - Convert project to Javascript/Typescript - Allow custom headers to be passed in (optional) - Allow body to be optional * Update action.yml * Update action.yml * Add support for environment variables (fixed #17) * Add support for header as environment variables * Run build and package Co-authored-by: Joel Male <joel@joelmale.com> * Bump @actions/core from 1.2.4 to 1.2.5 (#18) Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.4 to 1.2.5. - [Release notes](https://github.com/actions/toolkit/releases) - [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump @vercel/ncc from 0.23.0 to 0.24.0 (#16) Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.23.0 to 0.24.0. - [Release notes](https://github.com/vercel/ncc/releases) - [Commits](https://github.com/vercel/ncc/compare/0.23.0...0.24.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump prettier from 2.0.5 to 2.1.1 (#15) Bumps [prettier](https://github.com/prettier/prettier) from 2.0.5 to 2.1.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.0.5...2.1.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * ⬆️ Bump typescript from 3.9.7 to 4.0.2 (#13) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.9.7 to 4.0.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v3.9.7...v4.0.2) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Joel Male <joel@joelmale.com> * v2.0.1 * Add backwards compatibility Co-authored-by: Anand Chowdhary <github@anandchowdhary.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
---|---|---|
.. | ||
node_modules/.bin | ||
CHANGELOG.md | ||
eslint-plugin-prettier.js | ||
LICENSE.md | ||
package.json | ||
README.md |
eslint-plugin-prettier
Runs Prettier as an ESLint rule and reports differences as individual ESLint issues.
Sample
error: Insert `,` (prettier/prettier) at pkg/commons-atom/ActiveEditorRegistry.js:22:25:
20 | import {
21 | observeActiveEditorsDebounced,
> 22 | editorChangesDebounced
| ^
23 | } from './debounced';;
24 |
25 | import {observableFromSubscribeFunction} from '../commons-node/event';
error: Delete `;` (prettier/prettier) at pkg/commons-atom/ActiveEditorRegistry.js:23:21:
21 | observeActiveEditorsDebounced,
22 | editorChangesDebounced
> 23 | } from './debounced';;
| ^
24 |
25 | import {observableFromSubscribeFunction} from '../commons-node/event';
26 | import {cacheWhileSubscribed} from '../commons-node/observable';
2 errors found.
./node_modules/.bin/eslint --format codeframe pkg/commons-atom/ActiveEditorRegistry.js
(code from nuclide).
Installation
npm install --save-dev eslint-plugin-prettier
npm install --save-dev --save-exact prettier
eslint-plugin-prettier
does not install Prettier or ESLint for you. You must install these yourself.
Then, in your .eslintrc.json
:
{
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
}
Recommended Configuration
This plugin works best if you disable all other ESLint rules relating to code formatting, and only enable rules that detect patterns in the AST. (If another active ESLint rule disagrees with prettier
about how code should be formatted, it will be impossible to avoid lint errors.) You can use eslint-config-prettier to disable all formatting-related ESLint rules.
If your desired formatting does not match the prettier
output, you should use a different tool such as prettier-eslint instead.
To integrate this plugin with eslint-config-prettier
, you can use the "recommended"
configuration:
-
In addition to the above installation instructions, install
eslint-config-prettier
:npm install --save-dev eslint-config-prettier
-
Then you need to add
plugin:prettier/recommended
as the last extension in your.eslintrc.json
:{ "extends": ["plugin:prettier/recommended"] }
This does three things:
- Enables
eslint-plugin-prettier
. - Sets the
prettier/prettier
rule to"error"
. - Extends the
eslint-config-prettier
configuration.
You can then set Prettier's own options inside a .prettierrc
file.
- In order to support special ESLint plugins (e.g. eslint-plugin-react), add extra exclusions for the plugins you use like so:
{
"extends": [
"plugin:prettier/recommended",
"prettier/flowtype",
"prettier/react",
"prettier/standard"
]
}
For the list of every available exclusion rule set, please see the readme of eslint-config-prettier.
Options
Note: While it is possible to pass options to Prettier via your ESLint configuration file, it is not recommended because editor extensions such as
prettier-atom
andprettier-vscode
will read.prettierrc
, but won't read settings from ESLint, which can lead to an inconsistent experience.
-
The first option:
-
An object representing options that will be passed into prettier. Example:
"prettier/prettier": ["error", {"singleQuote": true, "parser": "flow"}]
NB: This option will merge and override any config set with
.prettierrc
files
-
-
The second option:
-
An object with the following options
-
usePrettierrc
: Enables loading of the Prettier configuration file, (default:true
). May be useful if you are using multiple tools that conflict with each other, or do not wish to mix your ESLint settings with your Prettier configuration."prettier/prettier": ["error", {}, { "usePrettierrc": false }]
-
fileInfoOptions
: Options that are passed to prettier.getFileInfo to decide whether a file needs to be formatted. Can be used for example to opt-out from ignoring files located innode_modules
directories."prettier/prettier": ["error", {}, { "fileInfoOptions": { "withNodeModules": true } }]
-
-
-
The rule is autofixable -- if you run
eslint
with the--fix
flag, your code will be formatted according toprettier
style.
Contributing
See CONTRIBUTING.md