diff --git a/.changeset/mighty-shoes-jam.md b/.changeset/mighty-shoes-jam.md new file mode 100644 index 00000000000..4bab4252fd0 --- /dev/null +++ b/.changeset/mighty-shoes-jam.md @@ -0,0 +1,5 @@ +--- +'@talend/scripts-config-prettier': patch +--- + +fix: prettier configuration for sort imports diff --git a/.prettierrc.js b/.prettierrc.js index 5ff6086e865..dafd473bcd2 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -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'), - }, - ], }; diff --git a/tools/babel-plugin-import-d3/src/index.test.js b/tools/babel-plugin-import-d3/src/index.test.js index 08c5090a26a..ec9df3eac1d 100644 --- a/tools/babel-plugin-import-d3/src/index.test.js +++ b/tools/babel-plugin-import-d3/src/index.test.js @@ -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 diff --git a/tools/babel-plugin-import-from-index/src/index.test.js b/tools/babel-plugin-import-from-index/src/index.test.js index 91b19330145..85efe1bb31f 100644 --- a/tools/babel-plugin-import-from-index/src/index.test.js +++ b/tools/babel-plugin-import-from-index/src/index.test.js @@ -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';", @@ -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';", diff --git a/tools/scripts-config-prettier/.prettierrc.js b/tools/scripts-config-prettier/.prettierrc.js index 1e0f97029a7..22760b2916f 100644 --- a/tools/scripts-config-prettier/.prettierrc.js +++ b/tools/scripts-config-prettier/.prettierrc.js @@ -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: [ @@ -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',