Skip to content

Commit

Permalink
chore: prevent running prettier twice on IDEs
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Sep 22, 2023
1 parent d15acce commit 5d2d9fc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* Indicates whether ESLint was run through `package.json` script.
* Used to identify IDE integrations.
*/
const IS_SCRIPT = process.env.npm_lifecycle_event === 'lint';

/** @type {import('eslint/lib/shared/types').ConfigData} */
module.exports = {
root: true,
Expand All @@ -13,9 +19,9 @@ module.exports = {
plugins: ['unicorn'],
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
IS_SCRIPT && 'plugin:prettier/recommended',
'plugin:astro/recommended',
],
].filter(Boolean),
rules: {
'unicorn/prefer-node-protocol': 'error',
},
Expand Down

0 comments on commit 5d2d9fc

Please sign in to comment.