devicon icon indicating copy to clipboard operation
devicon copied to clipboard

[OTHER] Alphabetically order devicon.json

Open Snailedlt opened this issue 1 year ago • 7 comments

I have searched through the issues and didn't find my problem.

  • [X] Confirm

What would you like to share?

Due to some recent merges, the devicon.json file has become unprdered. This should be fixed as soon as possible, and at the very least before the next release.

Additional information

Alphabetically ordering the file wilø make it easier to find icons, as well as making it less likely to cause conflicts with future updates to it.

Snailedlt avatar Aug 06 '22 00:08 Snailedlt

We could make a PR after merging the current PRs.

There're a bunch online tools to reorder JSON's + format document (spaces, lines, etc.)

kilianpaquier avatar Aug 06 '22 21:08 kilianpaquier

Yeah. I think the best thing would be to use a linter like prettier or eslint to automatically sort it alphabetically when a new PR is created or something. But that might be a bit of work to implement unless someone here has done it before :)

Snailedlt avatar Aug 06 '22 22:08 Snailedlt

In my opinion the easiest way for now would be to create a PR to lint the file, and check if users place correctly the new entry, and finally add an .editorconfig at root of the project.

EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.

See https://editorconfig.org/ , I used it in multiple projects and it's compatible with all majors IDEs. EditorConfig won't re-order the file alphabetically, but can ensure basic elements, like indentations, charset, final new line, end of line, etc...

The advantage of EditorConfig is that it's very simple to add to a project and you have nothing to do after that, no installation, no maintenance, etc...

For Devicon, we can only configure the JSON and SVG extensions, something like:

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true

[*.json]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.svg]
trim_trailing_whitespace = false

The idea to add a new action step to the merge process is still a valid good addition but since it can be a bit more complexe to setup maybe we can start with manual check and EditorConfig for formatting.

BenSouchet avatar Aug 12 '22 08:08 BenSouchet

@BenSouchet sounds like a good start. Do you want to add it?

Snailedlt avatar Aug 12 '22 09:08 Snailedlt

@Snailedlt I just created this PR https://github.com/devicons/devicon/pull/1344 😊

BenSouchet avatar Aug 12 '22 10:08 BenSouchet

In the PR I mention in my prev comment, I talk about spectral, a JSON linter that can be useful, and can maybe be linked in this project when a PR is merge in develop, or as an hook when maintainers add specific tag to a PR

BenSouchet avatar Aug 12 '22 10:08 BenSouchet

Nice! I'll take a look soon (hopefully). Added Panquesito as a reviewer too

Snailedlt avatar Aug 12 '22 15:08 Snailedlt