Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ⚙️ Refactor pattern code structure #2326

Merged
merged 7 commits into from
May 20, 2024
Merged

Conversation

PKief
Copy link
Owner

@PKief PKief commented May 13, 2024

Reduce amount of code and amount of logic to apply the patterns to the file icons.

@PKief PKief self-assigned this May 13, 2024
@PKief PKief merged commit 94e9ce8 into main May 20, 2024
4 checks passed
@PKief PKief deleted the feat/refactor-pattern-code branch May 20, 2024 10:29
Copy link

Merge Successful

Thanks for your contribution! 🎉

The changes will be part of the upcoming update on the marketplace.

@Airkro
Copy link
Contributor

Airkro commented May 22, 2024

Looks like the cosmiconfig pattern lose loss many extensions, it's in the plan?

@PKief
Copy link
Owner Author

PKief commented May 22, 2024

Looks like the cosmiconfig pattern lose loss many extensions, it's in the plan?

Which extensions are missing?

@Airkro
Copy link
Contributor

Airkro commented May 23, 2024

Run:

import { fileIcons } from './fileIcons';

const io = fileIcons.icons[220].fileNames?.join('\n');

console.log(io);

Get:

Before-------------------------------------- After-------------------------------
.stylelintrc
.stylelintrc.json
.stylelintrc.jsonc
.stylelintrc.json5
.stylelintrc.yaml
.stylelintrc.yml
.stylelintrc.toml
.stylelintrc.js
.stylelintrc.mjs
.stylelintrc.cjs
.stylelintrc.ts
.stylelintrc.mts
.stylelintrc.cts
.config/stylelintrc
.config/stylelintrc.json
.config/stylelintrc.jsonc
.config/stylelintrc.json5
.config/stylelintrc.yaml
.config/stylelintrc.yml
.config/stylelintrc.toml
.config/stylelintrc.js
.config/stylelintrc.mjs
.config/stylelintrc.cjs
.config/stylelintrc.ts
.config/stylelintrc.mts
.config/stylelintrc.cts
stylelint.config.json
stylelint.config.jsonc
stylelint.config.json5
stylelint.config.yaml
stylelint.config.yml
stylelint.config.toml
stylelint.config.js
stylelint.config.mjs
stylelint.config.cjs
stylelint.config.ts
stylelint.config.mts
stylelint.config.cts
.stylelintignore
.stylelintcache

.stylelintrc
.config/stylelintrc
stylelint.config
stylelint.js
stylelint.mjs
stylelint.cjs
stylelint.ts
stylelint.mts
stylelint.cts
stylelint.json
stylelint.jsonc
stylelint.json5
stylelint.yaml
stylelint.yml
stylelint.toml
.stylelintignore
.stylelintcache

@PKief
Copy link
Owner Author

PKief commented May 23, 2024

@Airkro thanks a lot, no it was not on purpose to remove some patterns. I've restored it, so that it should cover all patterns now: fe98e7c. The reason for the refactoring was to make the code more self-explanatory and more explicit what kind of file names are used for each pattern. I know that the code looks a bit more comprehensive but I prefer it that way.

@Airkro
Copy link
Contributor

Airkro commented May 24, 2024

These lines should be removed, they are not part of Cosmiconfig.
Sorry to show them in the debug code before.

`.${fileName}ignore`,
`.${fileName}cache`,

@Airkro
Copy link
Contributor

Airkro commented May 24, 2024

Looks like the cosmiconfig pattern lose loss many extensions, it's in the plan?

We should add some test cases for function parseByPattern, to avoid bugs like this.

@PKief
Copy link
Owner Author

PKief commented May 27, 2024

@Airkro thanks for the hint. I've updated the code and also added a unit test for the parseByPattern function :)

See commit: d8bdd33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants