Skip to content

Commit

Permalink
fix: prettier configuration for sort imports (#5002)
Browse files Browse the repository at this point in the history
  • Loading branch information
romainseb authored Nov 23, 2023
1 parent 9d3881a commit 5455b65
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 26 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-shoes-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/scripts-config-prettier': patch
---

fix: prettier configuration for sort imports
18 changes: 0 additions & 18 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
module.exports = {
...require('@talend/scripts-config-prettier'),
overrides: [
{
files: 'fork/module-to-cdn/**/*',
...require('./fork/module-to-cdn/.prettierrc'),
},
{
files: 'packages/design-system/**/*',
...require('./packages/design-system/.prettierrc'),
},
{
files: 'packages/stepper/**/*',
...require('./packages/stepper/.prettierrc'),
},
{
files: 'packages/storybook-docs/**/*',
...require('./packages/storybook-docs/.prettierrc'),
},
],
};
2 changes: 1 addition & 1 deletion tools/babel-plugin-import-d3/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pluginTester({
import { csv } from 'd3-fetch'`,
output: `
import { brush } from 'd3';
import { select, event, shape, scale as foo, csv } from 'd3';
import { csv, event, scale as foo, select, shape } from 'd3';
import get from 'lodash/get';`,
},
// should work in already compiled project
Expand Down
4 changes: 2 additions & 2 deletions tools/babel-plugin-import-from-index/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pluginTester({
output: `
import React from 'react';
import { SidePanel, Actions, ActionButton, ActionDropdown, List } from '@talend/react-components';`,
import { ActionButton, ActionDropdown, Actions, List, SidePanel } from '@talend/react-components';`,
},
{
code: "import React from 'react';",
Expand All @@ -60,7 +60,7 @@ pluginTester({
output: `
import React from 'react';
import { SidePanel, ModelViewer as ModelViewerComponent } from '@talend/react-components';`,
import { ModelViewer as ModelViewerComponent, SidePanel } from '@talend/react-components';`,
},
{
code: "import { RecordsViewer as RecordsViewerComponent, TooltipTrigger } from '@talend/react-components';",
Expand Down
8 changes: 3 additions & 5 deletions tools/scripts-config-prettier/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
const fs = require('fs');
const path = require('path');
const isTS = fs.existsSync(path.join(process.cwd(), 'tsconfig.json'));

module.exports = {
plugins: [require.resolve('@trivago/prettier-plugin-sort-imports')],
importOrder: [
Expand All @@ -16,7 +12,9 @@ module.exports = {
'.*scss',
],
importOrderSeparation: true,
importOrderParserPlugins: ['jsx', isTS && 'typescript'].filter(Boolean),
importOrderSortSpecifiers: true,
importOrderCaseInsensitive: true,
importOrderGroupNamespaceSpecifiers: true,
printWidth: 100,
singleQuote: true,
trailingComma: 'all',
Expand Down

0 comments on commit 5455b65

Please sign in to comment.