question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lint/check ignores local prettier.config.js config

See original GitHub issue

This leads to inconsistencies between with gts fix, for example:

$ cat prettier.config.js 
module.exports = {
  singleQuote: true,
  trailingComma: 'all',
};

$ node_modules/.bin/gts fix file.ts
Warning: The 'deprecation' rule requires type information.
Done in 2.06s.

$ node_modules/.bin/gts check file.ts
file.ts
Unnecessary trailing comma (trailing-comma)
  44 |     input: string,
  45 |     replacement: string,
> 46 |     count: number,
     |                                   ^
  47 |   ): string {
  48 |     if (replacement == null) return input;

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ofrobotscommented, May 16, 2019

Here’s another test I created that verifies the trailing comma option works as well:

  it('format should use user provided prettier.config.js 2', () => {
    return withFixtures({
      'tsconfig.json': JSON.stringify({ files: ['far.ts'] }),
      'prettier.config.js': `module.exports = {
  singleQuote: true,
  trailingComma: 'all',
};`,
      'far.ts': `export function far(
  ceiling: string,
  vines: string,
  sailed: number,
  ocean: number,
  tumbled: string,
): string {
  return 'where the wild things are';
}
`,
    }, async () => {
      const result = await format.format(OPTIONS, [], false);
      assert.strictEqual(result, true);
    });
  });

It seems to pass. A reproducing test repo / gist would be needed to investigate this further.

0reactions
ofrobotscommented, May 17, 2019

The solutions seems to be using something like tslint-config-prettier. It removes conflicting style rules from the tslint config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration File - Prettier
Prettier uses cosmiconfig for configuration file support. This means you can configure Prettier via (in order of precedence):.
Read more >
Prettier vscode extension ignoring config files - Stack Overflow
In VS Code press Ctrl + shift + p to open command palette then chose. Preferences: Open Settings(JSON) and add the line among...
Read more >
Prettier and ESLint Automation Cheat Sheet
Setup. Prettier; Eslint; StyleLint; Ability to validate code locally; Automatically run code validation with Husky and lint-staged ...
Read more >
Supported hooks - pre-commit
setup -cfg-fmt - apply a consistent format to `setup.cfg` files ... shell-lint - Check Shell Syntax on ALL staged files with user friendly...
Read more >
How to configure Prettier and VSCode - Gleb Bahmutov
The same JavaScript code in projectB/index.js gets formatted by Prettier using different local settings and ends up looking different.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found