Skip to content

Commit

Permalink
fix(#198): fix issue #198 by only displaying warn once
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Nov 9, 2020
1 parent e5b6503 commit 98a18a1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/rules/decorator-position.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const { CLIEngine } = require('eslint');

const cli = new CLIEngine();

// currently used for incomplete prettier config
let hasWarned = true;

module.exports = {
meta: {
type: 'layout',
Expand Down Expand Up @@ -334,11 +337,13 @@ function lineLength(userOptions, filePath) {

if (!('printWidth' in prettierOptions)) {
// 80 is prettier default
// eslint-disable-next-line no-console
console.warn(
'WARNING(eslint-plugin-decorator-position): printWidth not set in the prettier config, defaulting to 80'
);

if (!hasWarned) {
// eslint-disable-next-line no-console
console.warn(
'WARNING(eslint-plugin-decorator-position): printWidth not set in the prettier config, defaulting to 80'
);
hasWarned = true;
}
return { ...prettierOptions, ...userOptions, printWidth: 80 };
}

Expand Down

0 comments on commit 98a18a1

Please sign in to comment.