From 7ef0bb21b9151b9575f302c65ea004abc166e06a Mon Sep 17 00:00:00 2001 From: RyderKishan Date: Thu, 15 May 2025 16:07:39 +0530 Subject: [PATCH 1/9] feat: Import sort order skip files --- package.json | 4 +- src/index.ts | 7 +++ src/preprocessors/preprocessor.ts | 8 +++ src/utils/__tests__/should-skip-file.spec.ts | 61 ++++++++++++++++++++ src/utils/should-skip-file.ts | 30 ++++++++++ tsconfig.json | 2 +- yarn.lock | 12 ++++ 7 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 src/utils/__tests__/should-skip-file.spec.ts create mode 100644 src/utils/should-skip-file.ts diff --git a/package.json b/package.json index 9ba8fac2..4be80a58 100644 --- a/package.json +++ b/package.json @@ -38,13 +38,15 @@ "@babel/traverse": "^7.26.7", "@babel/types": "^7.26.7", "javascript-natural-sort": "^0.7.1", - "lodash": "^4.17.21" + "lodash": "^4.17.21", + "minimatch": "^10.0.1" }, "devDependencies": { "@babel/core": "^7.26.7", "@types/chai": "^5.0.1", "@types/jest": "^29.5.14", "@types/lodash": "^4.17.14", + "@types/minimatch": "^5.1.2", "@types/node": "^22.10.10", "@vue/compiler-sfc": "^3.5.13", "jest": "^29.7.0", diff --git a/src/index.ts b/src/index.ts index 216f609d..691da241 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,13 @@ import { createSvelteParsers } from './utils/create-svelte-parsers'; const svelteParsers = createSvelteParsers(); const options: Options = { + importOrderSkipFiles: { + type: 'path', + category: 'Global', + array: true, + default: [{ value: [] }], + description: 'Provide a list of files to skip sorting imports.', + }, importOrder: { type: 'path', category: 'Global', diff --git a/src/preprocessors/preprocessor.ts b/src/preprocessors/preprocessor.ts index 716212ec..0e0a6d01 100644 --- a/src/preprocessors/preprocessor.ts +++ b/src/preprocessors/preprocessor.ts @@ -7,6 +7,7 @@ import { getCodeFromAst } from '../utils/get-code-from-ast'; import { getExperimentalParserPlugins } from '../utils/get-experimental-parser-plugins'; import { getSortedNodes } from '../utils/get-sorted-nodes'; import { isSortImportsIgnored } from '../utils/is-sort-imports-ignored'; +import { shouldSkipFile } from '../utils/should-skip-file'; export function preprocessor(code: string, options: PrettierOptions) { const { @@ -18,8 +19,15 @@ export function preprocessor(code: string, options: PrettierOptions) { importOrderSortSpecifiers, importOrderSideEffects, importOrderImportAttributesKeyword, + importOrderSkipFiles, + filepath, } = options; + // Check if the file should be skipped + if (filepath && shouldSkipFile(filepath, (importOrderSkipFiles || []) as string[])) { + return code; + } + const parserOptions: ParserOptions = { sourceType: 'module', plugins: getExperimentalParserPlugins(importOrderParserPlugins), diff --git a/src/utils/__tests__/should-skip-file.spec.ts b/src/utils/__tests__/should-skip-file.spec.ts new file mode 100644 index 00000000..f6431c43 --- /dev/null +++ b/src/utils/__tests__/should-skip-file.spec.ts @@ -0,0 +1,61 @@ +import { shouldSkipFile } from '../should-skip-file'; + +describe('shouldSkipFile', () => { + it('should return false when skipPatterns is empty', () => { + expect(shouldSkipFile('src/file.ts', [])).toBe(false); + }); + + it('should return false when no patterns match', () => { + const patterns = ['test/*.ts', 'lib/*.js']; + expect(shouldSkipFile('src/file.ts', patterns)).toBe(false); + }); + + it('should return true when file matches a pattern', () => { + const patterns = ['src/*.ts', 'lib/*.js']; + expect(shouldSkipFile('src/file.ts', patterns)).toBe(true); + }); + + it('should handle glob patterns correctly', () => { + const patterns = ['*.test.ts', 'generated/**']; + expect(shouldSkipFile('Button.test.ts', patterns)).toBe(true); + expect(shouldSkipFile('generated/types.ts', patterns)).toBe(true); + expect(shouldSkipFile('src/Button.ts', patterns)).toBe(false); + }); + + it('should match filename-only patterns against basename', () => { + const patterns = ['*.js', 'example.ts']; + expect(shouldSkipFile('/long/path/to/file.js', patterns)).toBe(true); + expect(shouldSkipFile('/different/path/example.ts', patterns)).toBe(true); + expect(shouldSkipFile('/path/to/file.ts', patterns)).toBe(false); + }); + + it('should handle special characters in filenames', () => { + const patterns = ['*.spec.ts', '*test*.js']; + expect(shouldSkipFile('my-component.spec.ts', patterns)).toBe(true); + expect(shouldSkipFile('my.test.js', patterns)).toBe(true); + expect(shouldSkipFile('test.jsx', patterns)).toBe(false); + }); + + it('should handle multiple patterns with mixed path separators', () => { + const patterns = ['src/*.ts', 'test/*.js', '*.test.tsx']; + expect(shouldSkipFile('src/file.ts', patterns)).toBe(true); + expect(shouldSkipFile('test/file.js', patterns)).toBe(true); + expect(shouldSkipFile('component.test.tsx', patterns)).toBe(true); + expect(shouldSkipFile('src/sub/file.ts', patterns)).toBe(false); + }); + + it('should handle exact filename matches', () => { + const patterns = ['example.js', 'tsconfig.json']; + expect(shouldSkipFile('/any/path/example.js', patterns)).toBe(true); + expect(shouldSkipFile('/root/tsconfig.json', patterns)).toBe(true); + expect(shouldSkipFile('/path/to/example.test.js', patterns)).toBe(false); + }); + + it('should handle directory patterns', () => { + const patterns = ['test/**/*.*', 'generated/**/*.*']; + expect(shouldSkipFile('test/file.ts', patterns)).toBe(true); + expect(shouldSkipFile('test/unit/component.js', patterns)).toBe(true); + expect(shouldSkipFile('generated/types.ts', patterns)).toBe(true); + expect(shouldSkipFile('src/components/button.ts', patterns)).toBe(false); + }); +}); \ No newline at end of file diff --git a/src/utils/should-skip-file.ts b/src/utils/should-skip-file.ts new file mode 100644 index 00000000..c52a1f1d --- /dev/null +++ b/src/utils/should-skip-file.ts @@ -0,0 +1,30 @@ +import { minimatch } from 'minimatch'; +import path from 'path'; + +/** + * Checks if the current file path matches any of the patterns in importOrderSkipFiles + * @param filePath The path of the current file being processed + * @param skipPatterns Array of patterns for files to skip + * @returns boolean indicating whether the file should be skipped + */ +export function shouldSkipFile(filepath: string, skipPatterns: string[]): boolean { + if (skipPatterns.length === 0) { + return false; + } + + const normalizedPath = filepath.split(path.sep).join('/'); + const filename = path.basename(filepath); + + return skipPatterns.some(pattern => { + // Normalize pattern to use forward slashes + const normalizedPattern = pattern.split(path.sep).join('/'); + + // If pattern doesn't contain '/', match against filename only + if (!normalizedPattern.includes('/')) { + return minimatch(filename, normalizedPattern, { matchBase: true }); + } + + // Otherwise match against full path + return minimatch(normalizedPath, normalizedPattern); + }); +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 6bc2c975..aee6ddb5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/yarn.lock b/yarn.lock index 135f7dd8..9d6a6b38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -729,6 +729,11 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.14.tgz#bafc053533f4cdc5fcc9635af46a963c1f3deaff" integrity sha512-jsxagdikDiDBeIRaPYtArcT8my4tN1og7MtMRquFT3XNA6axxyHDRUemqDz/taRDdOUn0GnGHRCuff4q48sW9A== +"@types/minimatch@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + "@types/node@*": version "22.9.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-22.9.1.tgz#bdf91c36e0e7ecfb7257b2d75bf1b206b308ca71" @@ -2016,6 +2021,13 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +minimatch@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.1.tgz#ce0521856b453c86e25f2c4c0d03e6ff7ddc440b" + integrity sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ== + dependencies: + brace-expansion "^2.0.1" + minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" From b39a25f5423a0ae3b9583951befa8f96d03c9df0 Mon Sep 17 00:00:00 2001 From: RyderKishan Date: Thu, 15 May 2025 16:19:56 +0530 Subject: [PATCH 2/9] Downgraded minimatch for node 18 --- package.json | 2 +- yarn.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 4be80a58..ed36bf14 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@babel/types": "^7.26.7", "javascript-natural-sort": "^0.7.1", "lodash": "^4.17.21", - "minimatch": "^10.0.1" + "minimatch": "^9.0.0" }, "devDependencies": { "@babel/core": "^7.26.7", diff --git a/yarn.lock b/yarn.lock index 9d6a6b38..5b7a2ba3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2021,13 +2021,6 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -minimatch@^10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.1.tgz#ce0521856b453c86e25f2c4c0d03e6ff7ddc440b" - integrity sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ== - dependencies: - brace-expansion "^2.0.1" - minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -2042,6 +2035,13 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.0: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" From 716257b5c88406e285b6725823009189bb6b1500 Mon Sep 17 00:00:00 2001 From: RyderKishan Date: Thu, 15 May 2025 16:43:00 +0530 Subject: [PATCH 3/9] Added new types --- src/preprocessors/preprocessor.ts | 1 + src/types.ts | 1 + types/index.d.ts | 12 ++++++++++++ 3 files changed, 14 insertions(+) diff --git a/src/preprocessors/preprocessor.ts b/src/preprocessors/preprocessor.ts index 0e0a6d01..b76fdcba 100644 --- a/src/preprocessors/preprocessor.ts +++ b/src/preprocessors/preprocessor.ts @@ -53,6 +53,7 @@ export function preprocessor(code: string, options: PrettierOptions) { importOrderGroupNamespaceSpecifiers, importOrderSortSpecifiers, importOrderSideEffects, + importOrderSkipFiles, }); return getCodeFromAst(allImports, directives, code, interpreter, { diff --git a/src/types.ts b/src/types.ts index 085c0b15..32db66e9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -20,6 +20,7 @@ export type GetSortedNodes = ( | 'importOrderGroupNamespaceSpecifiers' | 'importOrderSortSpecifiers' | 'importOrderSideEffects' + | 'importOrderSkipFiles' >, ) => ImportOrLine[]; diff --git a/types/index.d.ts b/types/index.d.ts index 46bc56ee..025b74a3 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -105,6 +105,18 @@ used to order imports within each match group. * _Default behavior:_ When not specified, @babel/generator will try to match the style in the input code based on the AST shape. */ importOrderImportAttributesKeyword?: 'assert' | 'with' | 'with-legacy'; + + /** + * An array of glob patterns for files that should be skipped by the import sorting. + * Files matching these patterns will not have their imports sorted. + * + * ``` + * "importOrderSkipFiles": ["*.test.ts", "src/generated/**"] + * ``` + * + * @default [] + */ + importOrderSkipFiles?: string[]; } export type PrettierConfig = PluginConfig & Config; From 0ea752622a17444953968a1664a8d3772490a7e5 Mon Sep 17 00:00:00 2001 From: RyderKishan Date: Thu, 15 May 2025 17:20:21 +0530 Subject: [PATCH 4/9] (fix) Types error --- src/preprocessors/preprocessor.ts | 1 - src/types.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/preprocessors/preprocessor.ts b/src/preprocessors/preprocessor.ts index b76fdcba..0e0a6d01 100644 --- a/src/preprocessors/preprocessor.ts +++ b/src/preprocessors/preprocessor.ts @@ -53,7 +53,6 @@ export function preprocessor(code: string, options: PrettierOptions) { importOrderGroupNamespaceSpecifiers, importOrderSortSpecifiers, importOrderSideEffects, - importOrderSkipFiles, }); return getCodeFromAst(allImports, directives, code, interpreter, { diff --git a/src/types.ts b/src/types.ts index 32db66e9..085c0b15 100644 --- a/src/types.ts +++ b/src/types.ts @@ -20,7 +20,6 @@ export type GetSortedNodes = ( | 'importOrderGroupNamespaceSpecifiers' | 'importOrderSortSpecifiers' | 'importOrderSideEffects' - | 'importOrderSkipFiles' >, ) => ImportOrLine[]; From bf809366e1b6dc9f31b62572a26b9160c98ecb23 Mon Sep 17 00:00:00 2001 From: RyderKishan Date: Fri, 11 Jul 2025 11:20:47 +0530 Subject: [PATCH 5/9] (fix) PR review comments analysed and reviewed --- README.md | 6 ++++++ src/index.ts | 4 ++-- src/preprocessors/preprocessor.ts | 4 ++-- src/utils/should-skip-file.ts | 2 +- types/index.d.ts | 4 ++-- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9c29388f..f469bf17 100644 --- a/README.md +++ b/README.md @@ -267,6 +267,12 @@ In the end, the plugin returns final imports with _third party imports_ on top a The _third party imports_ position (it's top by default) can be overridden using the `` special word in the `importOrder`. +### Pattern Matching Implementation + +This plugin uses [minimatch](https://github.com/isaacs/minimatch) for pattern matching of import paths. The matching is performed using the exact version specified in the plugin's dependencies to ensure consistent behavior. This is important to note because different versions of minimatch or other glob matching libraries might have subtle differences in their pattern matching behavior. + +If you're experiencing unexpected matching behavior, please ensure you're using patterns compatible with minimatch's syntax, which might differ slightly from other glob implementations. + ### FAQ / Troubleshooting Having some trouble or an issue ? You can check [FAQ / Troubleshooting section](./docs/TROUBLESHOOTING.md). diff --git a/src/index.ts b/src/index.ts index 691da241..4eb8290b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,12 +12,12 @@ import { createSvelteParsers } from './utils/create-svelte-parsers'; const svelteParsers = createSvelteParsers(); const options: Options = { - importOrderSkipFiles: { + importOrderExclude: { type: 'path', category: 'Global', array: true, default: [{ value: [] }], - description: 'Provide a list of files to skip sorting imports.', + description: 'Provide a list of glob patterns to exclude from import sorting.', }, importOrder: { type: 'path', diff --git a/src/preprocessors/preprocessor.ts b/src/preprocessors/preprocessor.ts index 0e0a6d01..da3852dc 100644 --- a/src/preprocessors/preprocessor.ts +++ b/src/preprocessors/preprocessor.ts @@ -19,12 +19,12 @@ export function preprocessor(code: string, options: PrettierOptions) { importOrderSortSpecifiers, importOrderSideEffects, importOrderImportAttributesKeyword, - importOrderSkipFiles, + importOrderExclude, filepath, } = options; // Check if the file should be skipped - if (filepath && shouldSkipFile(filepath, (importOrderSkipFiles || []) as string[])) { + if (filepath && shouldSkipFile(filepath, (importOrderExclude || []) as string[])) { return code; } diff --git a/src/utils/should-skip-file.ts b/src/utils/should-skip-file.ts index c52a1f1d..2c883170 100644 --- a/src/utils/should-skip-file.ts +++ b/src/utils/should-skip-file.ts @@ -2,7 +2,7 @@ import { minimatch } from 'minimatch'; import path from 'path'; /** - * Checks if the current file path matches any of the patterns in importOrderSkipFiles + * Checks if the current file path matches any of the patterns in importOrderExclude * @param filePath The path of the current file being processed * @param skipPatterns Array of patterns for files to skip * @returns boolean indicating whether the file should be skipped diff --git a/types/index.d.ts b/types/index.d.ts index 025b74a3..4aa2c366 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -111,12 +111,12 @@ used to order imports within each match group. * Files matching these patterns will not have their imports sorted. * * ``` - * "importOrderSkipFiles": ["*.test.ts", "src/generated/**"] + * "importOrderExclude": ["*.test.ts", "src/generated/**"] * ``` * * @default [] */ - importOrderSkipFiles?: string[]; + importOrderExclude?: string[]; } export type PrettierConfig = PluginConfig & Config; From a7db2b53d9f646cf653e24a77379d16fb642e0cd Mon Sep 17 00:00:00 2001 From: RyderKishan Date: Fri, 11 Jul 2025 11:22:05 +0530 Subject: [PATCH 6/9] State now matches upstream/main --- README.md | 14 ++++---------- package.json | 4 +--- src/index.ts | 7 ------- src/preprocessors/preprocessor.ts | 8 -------- tsconfig.json | 2 +- types/index.d.ts | 12 ------------ yarn.lock | 12 ------------ 7 files changed, 6 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index f469bf17..1fb0befd 100644 --- a/README.md +++ b/README.md @@ -267,12 +267,6 @@ In the end, the plugin returns final imports with _third party imports_ on top a The _third party imports_ position (it's top by default) can be overridden using the `` special word in the `importOrder`. -### Pattern Matching Implementation - -This plugin uses [minimatch](https://github.com/isaacs/minimatch) for pattern matching of import paths. The matching is performed using the exact version specified in the plugin's dependencies to ensure consistent behavior. This is important to note because different versions of minimatch or other glob matching libraries might have subtle differences in their pattern matching behavior. - -If you're experiencing unexpected matching behavior, please ensure you're using patterns compatible with minimatch's syntax, which might differ slightly from other glob implementations. - ### FAQ / Troubleshooting Having some trouble or an issue ? You can check [FAQ / Troubleshooting section](./docs/TROUBLESHOOTING.md). @@ -305,10 +299,10 @@ debug some code in the plugin, check [Debugging Guidelines](./docs/DEBUG.md) ### Maintainers -| [Ayush Sharma](https://github.com/ayusharma) | [Behrang Yarahmadi](https://github.com/byara) | -| ------------------------------------------------------------------------ | --------------------------------------------------------------------- | -| ![ayusharma](https://avatars2.githubusercontent.com/u/6918450?s=120&v=4) | ![@byara](https://avatars2.githubusercontent.com/u/6979966?s=120&v=4) | -| [@ayusharma\_](https://twitter.com/ayusharma_) | [@behrang_y](https://twitter.com/behrang_y) | +| [Ayush Sharma](https://github.com/ayusharma) | [Behrang Yarahmadi](https://github.com/byara) | [Vladislav Arsenev](https://github.com/vladislavarsenev) | +| ------------------------------------------------------------------------ | --------------------------------------------------------------------- |--------------------------------------------------------------------------| +| ![ayusharma](https://avatars2.githubusercontent.com/u/6918450?s=120&v=4) | ![@byara](https://avatars2.githubusercontent.com/u/6979966?s=120&v=4) |![@vladislavarsenev](https://avatars.githubusercontent.com/u/51095682?s=120&v=4)| +| [@ayusharma](https://twitter.com/ayusharma_) | [@behrang_y](https://twitter.com/behrang_y) | | ### Disclaimer diff --git a/package.json b/package.json index ed36bf14..9ba8fac2 100644 --- a/package.json +++ b/package.json @@ -38,15 +38,13 @@ "@babel/traverse": "^7.26.7", "@babel/types": "^7.26.7", "javascript-natural-sort": "^0.7.1", - "lodash": "^4.17.21", - "minimatch": "^9.0.0" + "lodash": "^4.17.21" }, "devDependencies": { "@babel/core": "^7.26.7", "@types/chai": "^5.0.1", "@types/jest": "^29.5.14", "@types/lodash": "^4.17.14", - "@types/minimatch": "^5.1.2", "@types/node": "^22.10.10", "@vue/compiler-sfc": "^3.5.13", "jest": "^29.7.0", diff --git a/src/index.ts b/src/index.ts index 4eb8290b..216f609d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,13 +12,6 @@ import { createSvelteParsers } from './utils/create-svelte-parsers'; const svelteParsers = createSvelteParsers(); const options: Options = { - importOrderExclude: { - type: 'path', - category: 'Global', - array: true, - default: [{ value: [] }], - description: 'Provide a list of glob patterns to exclude from import sorting.', - }, importOrder: { type: 'path', category: 'Global', diff --git a/src/preprocessors/preprocessor.ts b/src/preprocessors/preprocessor.ts index da3852dc..716212ec 100644 --- a/src/preprocessors/preprocessor.ts +++ b/src/preprocessors/preprocessor.ts @@ -7,7 +7,6 @@ import { getCodeFromAst } from '../utils/get-code-from-ast'; import { getExperimentalParserPlugins } from '../utils/get-experimental-parser-plugins'; import { getSortedNodes } from '../utils/get-sorted-nodes'; import { isSortImportsIgnored } from '../utils/is-sort-imports-ignored'; -import { shouldSkipFile } from '../utils/should-skip-file'; export function preprocessor(code: string, options: PrettierOptions) { const { @@ -19,15 +18,8 @@ export function preprocessor(code: string, options: PrettierOptions) { importOrderSortSpecifiers, importOrderSideEffects, importOrderImportAttributesKeyword, - importOrderExclude, - filepath, } = options; - // Check if the file should be skipped - if (filepath && shouldSkipFile(filepath, (importOrderExclude || []) as string[])) { - return code; - } - const parserOptions: ParserOptions = { sourceType: 'module', plugins: getExperimentalParserPlugins(importOrderParserPlugins), diff --git a/tsconfig.json b/tsconfig.json index aee6ddb5..6bc2c975 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/types/index.d.ts b/types/index.d.ts index 4aa2c366..46bc56ee 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -105,18 +105,6 @@ used to order imports within each match group. * _Default behavior:_ When not specified, @babel/generator will try to match the style in the input code based on the AST shape. */ importOrderImportAttributesKeyword?: 'assert' | 'with' | 'with-legacy'; - - /** - * An array of glob patterns for files that should be skipped by the import sorting. - * Files matching these patterns will not have their imports sorted. - * - * ``` - * "importOrderExclude": ["*.test.ts", "src/generated/**"] - * ``` - * - * @default [] - */ - importOrderExclude?: string[]; } export type PrettierConfig = PluginConfig & Config; diff --git a/yarn.lock b/yarn.lock index 5b7a2ba3..135f7dd8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -729,11 +729,6 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.14.tgz#bafc053533f4cdc5fcc9635af46a963c1f3deaff" integrity sha512-jsxagdikDiDBeIRaPYtArcT8my4tN1og7MtMRquFT3XNA6axxyHDRUemqDz/taRDdOUn0GnGHRCuff4q48sW9A== -"@types/minimatch@^5.1.2": - version "5.1.2" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" - integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== - "@types/node@*": version "22.9.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-22.9.1.tgz#bdf91c36e0e7ecfb7257b2d75bf1b206b308ca71" @@ -2035,13 +2030,6 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" -minimatch@^9.0.0: - version "9.0.5" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" - integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== - dependencies: - brace-expansion "^2.0.1" - ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" From b4dea42c0507d065fac876e24d349c83728ae8a5 Mon Sep 17 00:00:00 2001 From: RyderKishan Date: Fri, 11 Jul 2025 11:24:31 +0530 Subject: [PATCH 7/9] Revert "State now matches upstream/main" This reverts commit a7db2b53d9f646cf653e24a77379d16fb642e0cd. --- README.md | 14 ++++++++++---- package.json | 4 +++- src/index.ts | 7 +++++++ src/preprocessors/preprocessor.ts | 8 ++++++++ tsconfig.json | 2 +- types/index.d.ts | 12 ++++++++++++ yarn.lock | 12 ++++++++++++ 7 files changed, 53 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1fb0befd..f469bf17 100644 --- a/README.md +++ b/README.md @@ -267,6 +267,12 @@ In the end, the plugin returns final imports with _third party imports_ on top a The _third party imports_ position (it's top by default) can be overridden using the `` special word in the `importOrder`. +### Pattern Matching Implementation + +This plugin uses [minimatch](https://github.com/isaacs/minimatch) for pattern matching of import paths. The matching is performed using the exact version specified in the plugin's dependencies to ensure consistent behavior. This is important to note because different versions of minimatch or other glob matching libraries might have subtle differences in their pattern matching behavior. + +If you're experiencing unexpected matching behavior, please ensure you're using patterns compatible with minimatch's syntax, which might differ slightly from other glob implementations. + ### FAQ / Troubleshooting Having some trouble or an issue ? You can check [FAQ / Troubleshooting section](./docs/TROUBLESHOOTING.md). @@ -299,10 +305,10 @@ debug some code in the plugin, check [Debugging Guidelines](./docs/DEBUG.md) ### Maintainers -| [Ayush Sharma](https://github.com/ayusharma) | [Behrang Yarahmadi](https://github.com/byara) | [Vladislav Arsenev](https://github.com/vladislavarsenev) | -| ------------------------------------------------------------------------ | --------------------------------------------------------------------- |--------------------------------------------------------------------------| -| ![ayusharma](https://avatars2.githubusercontent.com/u/6918450?s=120&v=4) | ![@byara](https://avatars2.githubusercontent.com/u/6979966?s=120&v=4) |![@vladislavarsenev](https://avatars.githubusercontent.com/u/51095682?s=120&v=4)| -| [@ayusharma](https://twitter.com/ayusharma_) | [@behrang_y](https://twitter.com/behrang_y) | | +| [Ayush Sharma](https://github.com/ayusharma) | [Behrang Yarahmadi](https://github.com/byara) | +| ------------------------------------------------------------------------ | --------------------------------------------------------------------- | +| ![ayusharma](https://avatars2.githubusercontent.com/u/6918450?s=120&v=4) | ![@byara](https://avatars2.githubusercontent.com/u/6979966?s=120&v=4) | +| [@ayusharma\_](https://twitter.com/ayusharma_) | [@behrang_y](https://twitter.com/behrang_y) | ### Disclaimer diff --git a/package.json b/package.json index 9ba8fac2..ed36bf14 100644 --- a/package.json +++ b/package.json @@ -38,13 +38,15 @@ "@babel/traverse": "^7.26.7", "@babel/types": "^7.26.7", "javascript-natural-sort": "^0.7.1", - "lodash": "^4.17.21" + "lodash": "^4.17.21", + "minimatch": "^9.0.0" }, "devDependencies": { "@babel/core": "^7.26.7", "@types/chai": "^5.0.1", "@types/jest": "^29.5.14", "@types/lodash": "^4.17.14", + "@types/minimatch": "^5.1.2", "@types/node": "^22.10.10", "@vue/compiler-sfc": "^3.5.13", "jest": "^29.7.0", diff --git a/src/index.ts b/src/index.ts index 216f609d..4eb8290b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,13 @@ import { createSvelteParsers } from './utils/create-svelte-parsers'; const svelteParsers = createSvelteParsers(); const options: Options = { + importOrderExclude: { + type: 'path', + category: 'Global', + array: true, + default: [{ value: [] }], + description: 'Provide a list of glob patterns to exclude from import sorting.', + }, importOrder: { type: 'path', category: 'Global', diff --git a/src/preprocessors/preprocessor.ts b/src/preprocessors/preprocessor.ts index 716212ec..da3852dc 100644 --- a/src/preprocessors/preprocessor.ts +++ b/src/preprocessors/preprocessor.ts @@ -7,6 +7,7 @@ import { getCodeFromAst } from '../utils/get-code-from-ast'; import { getExperimentalParserPlugins } from '../utils/get-experimental-parser-plugins'; import { getSortedNodes } from '../utils/get-sorted-nodes'; import { isSortImportsIgnored } from '../utils/is-sort-imports-ignored'; +import { shouldSkipFile } from '../utils/should-skip-file'; export function preprocessor(code: string, options: PrettierOptions) { const { @@ -18,8 +19,15 @@ export function preprocessor(code: string, options: PrettierOptions) { importOrderSortSpecifiers, importOrderSideEffects, importOrderImportAttributesKeyword, + importOrderExclude, + filepath, } = options; + // Check if the file should be skipped + if (filepath && shouldSkipFile(filepath, (importOrderExclude || []) as string[])) { + return code; + } + const parserOptions: ParserOptions = { sourceType: 'module', plugins: getExperimentalParserPlugins(importOrderParserPlugins), diff --git a/tsconfig.json b/tsconfig.json index 6bc2c975..aee6ddb5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/types/index.d.ts b/types/index.d.ts index 46bc56ee..4aa2c366 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -105,6 +105,18 @@ used to order imports within each match group. * _Default behavior:_ When not specified, @babel/generator will try to match the style in the input code based on the AST shape. */ importOrderImportAttributesKeyword?: 'assert' | 'with' | 'with-legacy'; + + /** + * An array of glob patterns for files that should be skipped by the import sorting. + * Files matching these patterns will not have their imports sorted. + * + * ``` + * "importOrderExclude": ["*.test.ts", "src/generated/**"] + * ``` + * + * @default [] + */ + importOrderExclude?: string[]; } export type PrettierConfig = PluginConfig & Config; diff --git a/yarn.lock b/yarn.lock index 135f7dd8..5b7a2ba3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -729,6 +729,11 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.14.tgz#bafc053533f4cdc5fcc9635af46a963c1f3deaff" integrity sha512-jsxagdikDiDBeIRaPYtArcT8my4tN1og7MtMRquFT3XNA6axxyHDRUemqDz/taRDdOUn0GnGHRCuff4q48sW9A== +"@types/minimatch@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + "@types/node@*": version "22.9.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-22.9.1.tgz#bdf91c36e0e7ecfb7257b2d75bf1b206b308ca71" @@ -2030,6 +2035,13 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.0: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" From f5df5ae34a3373245a4ff6aef28130054f6bf99a Mon Sep 17 00:00:00 2001 From: RyderKishan Date: Fri, 11 Jul 2025 11:33:40 +0530 Subject: [PATCH 8/9] Fixed version mis matches --- package.json | 3 +- yarn.lock | 330 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 331 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ed0cd960..49674ad2 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "@types/babel__core": "^7.20.5", "@types/babel__generator": "^7.27.0", "@types/babel__traverse": "^7.20.7", + "@types/jest": "^30.0.0", "@types/lodash-es": "^4.17.12", "@types/minimatch": "^5.1.2", "@types/node": "^22.10.10", @@ -81,4 +82,4 @@ "@types/babel__generator": "7.6.8", "@babel/types": "7.26.7" } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 5781a1b0..25953ed2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19,6 +19,15 @@ js-tokens "^4.0.0" picocolors "^1.0.0" +"@babel/code-frame@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" + integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== + dependencies: + "@babel/helper-validator-identifier" "^7.27.1" + js-tokens "^4.0.0" + picocolors "^1.1.1" + "@babel/compat-data@^7.26.5": version "7.26.5" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.5.tgz#df93ac37f4417854130e21d72c66ff3d4b897fc7" @@ -105,6 +114,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== +"@babel/helper-validator-identifier@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" + integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== + "@babel/helper-validator-option@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz#86e45bd8a49ab7e03f276577f96179653d41da72" @@ -312,6 +326,51 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.25.6.tgz#4276edd5c105bc28b11c6a1f76fb9d29d1bd25c1" integrity sha512-NgJPHHbEpLQgDH2MjQu90pzW/5vvXIZ7KOnPyNBm92A6WgZ/7b6fJyUBjoumLqeOQQGqY2QjQxRo97ah4Sj0cA== +"@jest/diff-sequences@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/diff-sequences/-/diff-sequences-30.0.1.tgz#0ededeae4d071f5c8ffe3678d15f3a1be09156be" + integrity sha512-n5H8QLDJ47QqbCNn5SuFjCRDrOLEZ0h8vAHCK5RL9Ls7Xa8AQLa/YxAc9UjFqoEDM48muwtBGjtMY5cr0PLDCw== + +"@jest/expect-utils@30.0.4": + version "30.0.4" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.0.4.tgz#0512fb2588c7fc463ce26fb38c0d47814266d965" + integrity sha512-EgXecHDNfANeqOkcak0DxsoVI4qkDUsR7n/Lr2vtmTBjwLPBnnPOF71S11Q8IObWzxm2QgQoY6f9hzrRD3gHRA== + dependencies: + "@jest/get-type" "30.0.1" + +"@jest/get-type@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/get-type/-/get-type-30.0.1.tgz#0d32f1bbfba511948ad247ab01b9007724fc9f52" + integrity sha512-AyYdemXCptSRFirI5EPazNxyPwAL0jXt3zceFjaj8NFiKP9pOi0bfXonf6qkf82z2t3QWPeLCWWw4stPBzctLw== + +"@jest/pattern@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/pattern/-/pattern-30.0.1.tgz#d5304147f49a052900b4b853dedb111d080e199f" + integrity sha512-gWp7NfQW27LaBQz3TITS8L7ZCQ0TLvtmI//4OwlQRx4rnWxcPNIYjxZpDcN4+UlGxgm3jS5QPz8IPTCkb59wZA== + dependencies: + "@types/node" "*" + jest-regex-util "30.0.1" + +"@jest/schemas@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-30.0.1.tgz#27c00d707d480ece0c19126af97081a1af3bc46e" + integrity sha512-+g/1TKjFuGrf1Hh0QPCv0gISwBxJ+MQSNXmG9zjHy7BmFhtoJ9fdNhWJp3qUKRi93AOZHXtdxZgJ1vAtz6z65w== + dependencies: + "@sinclair/typebox" "^0.34.0" + +"@jest/types@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-30.0.1.tgz#a46df6a99a416fa685740ac4264b9f9cd7da1598" + integrity sha512-HGwoYRVF0QSKJu1ZQX0o5ZrUrrhj0aOOFA8hXrumD7SIzjouevhawbTjmXdwOmURdGluU9DM/XvGm3NyFoiQjw== + dependencies: + "@jest/pattern" "30.0.1" + "@jest/schemas" "30.0.1" + "@types/istanbul-lib-coverage" "^2.0.6" + "@types/istanbul-reports" "^3.0.4" + "@types/node" "*" + "@types/yargs" "^17.0.33" + chalk "^4.1.2" + "@jridgewell/gen-mapping@^0.3.5": version "0.3.5" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" @@ -454,6 +513,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.44.2.tgz#660018c9696ad4f48abe8c5d56db53c81aadba25" integrity sha512-3+QZROYfJ25PDcxFF66UEk8jGWigHJeecZILvkPkyQN7oc5BvFo4YEXFkOs154j3FTMp9mn9Ky8RCOwastduEA== +"@sinclair/typebox@^0.34.0": + version "0.34.37" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.34.37.tgz#f331e4db64ff8195e9e3d8449343c85aaa237d6e" + integrity sha512-2TRuQVgQYfy+EzHRTIvkhv2ADEouJ2xNS/Vq+W5EuuewBdOrvATvljZTxHWZSTYr2sTjTHpGvucaGAt67S2akw== + "@types/babel__core@^7.20.5": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" @@ -516,6 +580,33 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== + +"@types/istanbul-lib-report@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.4": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/jest@^30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-30.0.0.tgz#5e85ae568006712e4ad66f25433e9bdac8801f1d" + integrity sha512-XTYugzhuwqWjws0CVz8QpM36+T+Dz5mTEBKhNs/esGLnCIlGdRy+Dq78NRjd7ls7r8BC8ZRMOrKlkO1hU0JOwA== + dependencies: + expect "^30.0.0" + pretty-format "^30.0.0" + "@types/lodash-es@^4.17.12": version "4.17.12" resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.12.tgz#65f6d1e5f80539aa7cfbfc962de5def0cf4f341b" @@ -533,6 +624,13 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== +"@types/node@*": + version "24.0.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.13.tgz#93ed8c05c7b188a59760be0ce2ee3fa7ad0f83f6" + integrity sha512-Qm9OYVOFHFYg3wJoTSrz80hoec5Lia/dPp84do3X7dZvLikQvM1YpmvTBEdIr/e+U8HTkFjLHLnl78K/qjf+jQ== + dependencies: + undici-types "~7.8.0" + "@types/node@^22.10.10": version "22.10.10" resolved "https://registry.yarnpkg.com/@types/node/-/node-22.10.10.tgz#85fe89f8bf459dc57dfef1689bd5b52ad1af07e6" @@ -540,6 +638,23 @@ dependencies: undici-types "~6.20.0" +"@types/stack-utils@^2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" + integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== + +"@types/yargs-parser@*": + version "21.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== + +"@types/yargs@^17.0.33": + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.33.tgz#8c32303da83eec050a84b3c7ae7b9f922d13e32d" + integrity sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA== + dependencies: + "@types/yargs-parser" "*" + "@vitest/expect@3.2.4": version "3.2.4" resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-3.2.4.tgz#8362124cd811a5ee11c5768207b9df53d34f2433" @@ -653,6 +768,18 @@ acorn@^8.10.0, acorn@^8.9.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +ansi-styles@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + aria-query@^5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e" @@ -670,6 +797,25 @@ axobject-query@^4.0.0: resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-4.1.0.tgz#28768c76d0e3cff21bc62a9e2d0b6ac30042a1ee" integrity sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ== +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +brace-expansion@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.2.tgz#54fc53237a613d854c7bd37463aad17df87214e7" + integrity sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ== + dependencies: + balanced-match "^1.0.0" + +braces@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== + dependencies: + fill-range "^7.1.1" + browserslist@^4.24.0: version "4.24.2" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.2.tgz#f5845bc91069dbd55ee89faf9822e1d885d16580" @@ -701,11 +847,24 @@ chai@^5.2.0: loupe "^3.1.0" pathval "^2.0.0" +chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + check-error@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/check-error/-/check-error-2.1.1.tgz#87eb876ae71ee388fa0471fe423f494be1d96ccc" integrity sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw== +ci-info@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.3.0.tgz#c39b1013f8fdbd28cd78e62318357d02da160cd7" + integrity sha512-l+2bNRMiQgcfILUi33labAZYIWlH1kWDp+ecNo5iisRKrbm0xcRyCww71/YU0Fkw0mAFpz9bJayXPjey6vkmaQ== + code-red@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/code-red/-/code-red-1.0.4.tgz#59ba5c9d1d320a4ef795bc10a28bd42bfebe3e35" @@ -717,6 +876,18 @@ code-red@^1.0.3: estree-walker "^3.0.3" periscopic "^3.1.0" +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + convert-source-map@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" @@ -806,6 +977,11 @@ escalade@^3.2.0: resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + estree-walker@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" @@ -823,11 +999,30 @@ expect-type@^1.2.1: resolved "https://registry.yarnpkg.com/expect-type/-/expect-type-1.2.2.tgz#c030a329fb61184126c8447585bc75a7ec6fbff3" integrity sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA== +expect@^30.0.0: + version "30.0.4" + resolved "https://registry.yarnpkg.com/expect/-/expect-30.0.4.tgz#23ce0eaa9a1dcd72fcb78a228b9babdbcf9ddeca" + integrity sha512-dDLGjnP2cKbEppxVICxI/Uf4YemmGMPNy0QytCbfafbpYk9AFQsxb8Uyrxii0RPK7FWgLGlSem+07WirwS3cFQ== + dependencies: + "@jest/expect-utils" "30.0.4" + "@jest/get-type" "30.0.1" + jest-matcher-utils "30.0.4" + jest-message-util "30.0.2" + jest-mock "30.0.2" + jest-util "30.0.2" + fdir@^6.4.4, fdir@^6.4.6: version "6.4.6" resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.6.tgz#2b268c0232697063111bbf3f64810a2a741ba281" integrity sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w== +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== + dependencies: + to-regex-range "^5.0.1" + fsevents@~2.3.2, fsevents@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" @@ -843,6 +1038,21 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== +graceful-fs@^4.2.11: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + is-reference@^3.0.0, is-reference@^3.0.1: version "3.0.2" resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-3.0.2.tgz#154747a01f45cd962404ee89d43837af2cba247c" @@ -855,6 +1065,67 @@ javascript-natural-sort@^0.7.1: resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59" integrity sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw== +jest-diff@30.0.4: + version "30.0.4" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.0.4.tgz#f6e71d19ed6e8f5c7f1bead9ac406c0dd6abce5a" + integrity sha512-TSjceIf6797jyd+R64NXqicttROD+Qf98fex7CowmlSn7f8+En0da1Dglwr1AXxDtVizoxXYZBlUQwNhoOXkNw== + dependencies: + "@jest/diff-sequences" "30.0.1" + "@jest/get-type" "30.0.1" + chalk "^4.1.2" + pretty-format "30.0.2" + +jest-matcher-utils@30.0.4: + version "30.0.4" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.0.4.tgz#1aab71eb7ba401f81d9ef7231feb88392e4a6e54" + integrity sha512-ubCewJ54YzeAZ2JeHHGVoU+eDIpQFsfPQs0xURPWoNiO42LGJ+QGgfSf+hFIRplkZDkhH5MOvuxHKXRTUU3dUQ== + dependencies: + "@jest/get-type" "30.0.1" + chalk "^4.1.2" + jest-diff "30.0.4" + pretty-format "30.0.2" + +jest-message-util@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-30.0.2.tgz#9dfdc37570d172f0ffdc42a0318036ff4008837f" + integrity sha512-vXywcxmr0SsKXF/bAD7t7nMamRvPuJkras00gqYeB1V0WllxZrbZ0paRr3XqpFU2sYYjD0qAaG2fRyn/CGZ0aw== + dependencies: + "@babel/code-frame" "^7.27.1" + "@jest/types" "30.0.1" + "@types/stack-utils" "^2.0.3" + chalk "^4.1.2" + graceful-fs "^4.2.11" + micromatch "^4.0.8" + pretty-format "30.0.2" + slash "^3.0.0" + stack-utils "^2.0.6" + +jest-mock@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-30.0.2.tgz#5e4245f25f6f9532714906cab10a2b9e39eb2183" + integrity sha512-PnZOHmqup/9cT/y+pXIVbbi8ID6U1XHRmbvR7MvUy4SLqhCbwpkmXhLbsWbGewHrV5x/1bF7YDjs+x24/QSvFA== + dependencies: + "@jest/types" "30.0.1" + "@types/node" "*" + jest-util "30.0.2" + +jest-regex-util@30.0.1: + version "30.0.1" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-30.0.1.tgz#f17c1de3958b67dfe485354f5a10093298f2a49b" + integrity sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA== + +jest-util@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-30.0.2.tgz#1bd8411f81e6f5e2ca8b31bb2534ebcd7cbac065" + integrity sha512-8IyqfKS4MqprBuUpZNlFB5l+WFehc8bfCe1HSZFHzft2mOuND8Cvi9r1musli+u6F3TqanCZ/Ik4H4pXUolZIg== + dependencies: + "@jest/types" "30.0.1" + "@types/node" "*" + chalk "^4.1.2" + ci-info "^4.2.0" + graceful-fs "^4.2.11" + picomatch "^4.0.2" + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -923,6 +1194,13 @@ mdn-data@2.0.30: resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.30.tgz#ce4df6f80af6cfbe218ecd5c552ba13c4dfa08cc" integrity sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA== +micromatch@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== + dependencies: + braces "^3.0.3" + picomatch "^2.3.1" minimatch@^9.0.0: version "9.0.5" @@ -980,6 +1258,11 @@ picocolors@^1.1.0, picocolors@^1.1.1: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== +picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + picomatch@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" @@ -1013,6 +1296,20 @@ prettier@^3.4.2: resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.4.2.tgz#a5ce1fb522a588bf2b78ca44c6e6fe5aa5a2b13f" integrity sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ== +pretty-format@30.0.2, pretty-format@^30.0.0: + version "30.0.2" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-30.0.2.tgz#54717b6aa2b4357a2e6d83868e10a2ea8dd647c7" + integrity sha512-yC5/EBSOrTtqhCKfLHqoUIAXVRZnukHPwWBJWR7h84Q3Be1DRQZLncwcfLoPA5RPQ65qfiCMqgYwdUuQ//eVpg== + dependencies: + "@jest/schemas" "30.0.1" + ansi-styles "^5.2.0" + react-is "^18.3.1" + +react-is@^18.3.1: + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== + rollup@^4.40.0: version "4.44.2" resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.44.2.tgz#faedb27cb2aa6742530c39668092eecbaf78c488" @@ -1052,6 +1349,11 @@ siginfo@^2.0.0: resolved "https://registry.yarnpkg.com/siginfo/-/siginfo-2.0.0.tgz#32e76c70b79724e3bb567cb9d543eb858ccfaf30" integrity sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g== +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + source-map-js@^1.0.1: version "1.2.0" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" @@ -1062,6 +1364,13 @@ source-map-js@^1.2.0, source-map-js@^1.2.1: resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== +stack-utils@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + stackback@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/stackback/-/stackback-0.0.2.tgz#1ac8a0d9483848d1695e418b6d031a3c3ce68e3b" @@ -1079,6 +1388,13 @@ strip-literal@^3.0.0: dependencies: js-tokens "^9.0.1" +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + svelte@^4.2.19: version "4.2.19" resolved "https://registry.yarnpkg.com/svelte/-/svelte-4.2.19.tgz#4e6e84a8818e2cd04ae0255fcf395bc211e61d4c" @@ -1132,6 +1448,13 @@ tinyspy@^4.0.3: resolved "https://registry.yarnpkg.com/tinyspy/-/tinyspy-4.0.3.tgz#d1d0f0602f4c15f1aae083a34d6d0df3363b1b52" integrity sha512-t2T/WLB2WRgZ9EpE4jgPJ9w+i66UZfDc8wHh0xrwiRNN+UwH98GIJkTeZqX9rg0i0ptwzqW+uYeIF0T4F8LR7A== +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + typescript@^5.7.3: version "5.7.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" @@ -1142,6 +1465,11 @@ undici-types@~6.20.0: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433" integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg== +undici-types@~7.8.0: + version "7.8.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" + integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== + update-browserslist-db@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz#80846fba1d79e82547fb661f8d141e0945755fe5" @@ -1215,4 +1543,4 @@ why-is-node-running@^2.3.0: yallist@^3.0.2: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" - integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== \ No newline at end of file + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== From 9acb229e3314fc109ee275bee6f2feeb934c1971 Mon Sep 17 00:00:00 2001 From: Vladislav Arsenev Date: Fri, 24 Oct 2025 16:11:11 +0200 Subject: [PATCH 9/9] prettify files --- src/index.ts | 3 ++- src/utils/should-skip-file.ts | 13 ++++++++----- types/index.d.ts | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index c19a19f5..b449bfd2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,7 +20,8 @@ const options: Options = { category: 'Global', array: true, default: [{ value: [] }], - description: 'Provide a list of glob patterns to exclude from import sorting.', + description: + 'Provide a list of glob patterns to exclude from import sorting.', }, importOrder: { type: 'path', diff --git a/src/utils/should-skip-file.ts b/src/utils/should-skip-file.ts index 2c883170..73c377d7 100644 --- a/src/utils/should-skip-file.ts +++ b/src/utils/should-skip-file.ts @@ -7,7 +7,10 @@ import path from 'path'; * @param skipPatterns Array of patterns for files to skip * @returns boolean indicating whether the file should be skipped */ -export function shouldSkipFile(filepath: string, skipPatterns: string[]): boolean { +export function shouldSkipFile( + filepath: string, + skipPatterns: string[], +): boolean { if (skipPatterns.length === 0) { return false; } @@ -15,16 +18,16 @@ export function shouldSkipFile(filepath: string, skipPatterns: string[]): boolea const normalizedPath = filepath.split(path.sep).join('/'); const filename = path.basename(filepath); - return skipPatterns.some(pattern => { + return skipPatterns.some((pattern) => { // Normalize pattern to use forward slashes const normalizedPattern = pattern.split(path.sep).join('/'); - + // If pattern doesn't contain '/', match against filename only if (!normalizedPattern.includes('/')) { return minimatch(filename, normalizedPattern, { matchBase: true }); } - + // Otherwise match against full path return minimatch(normalizedPath, normalizedPattern); }); -} \ No newline at end of file +} diff --git a/types/index.d.ts b/types/index.d.ts index 6ee8166e..8019b888 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -125,11 +125,11 @@ used to order imports within each match group. /** * An array of glob patterns for files that should be skipped by the import sorting. * Files matching these patterns will not have their imports sorted. - * + * * ``` * "importOrderExclude": ["*.test.ts", "src/generated/**"] * ``` - * + * * @default [] */ importOrderExclude?: string[];