Commit Graph

32 Commits

Author SHA1 Message Date
Eric Cornelissen
e0df400494
Setup prettier (#6758)
* Add prettier as a dependency

* Add format command and configure prettier

I opted for single quotes to be in line with other simple-icons projects

I ignore the data file because changing its formatting is quite a bit of
trouble for all open PRs.

* Run prettier

* Replace all functions by arrow functions

* Move prettier configuration to config file

Move it to a file so editors (and other software) can pick up on the
configuration. I went with .js because (a) it allows for comments and
(2) it seems most of the config files are in JavaScript already.

* Add prettier --check when running npm run lint (This adds it to the CI as well)

* Add husky and format changes before committing

* Use object destructuring for imports consistently

* Add shebang and fileoverview to jsonlint.js
2021-10-25 21:13:10 +02:00
Álvaro Mondéjar
f726999af2
Unify SVGs for HTML safe titles reporting encoding errors in linting (#6522)
* Basic implementation

* Fix error

* Update icons

* Tweak implementation

* Minor changes

* Apply suggested changes

* Don't encode 34 and 39 codepoints (double and single quotes)

* Fix comments
2021-10-02 16:46:07 +02:00
Álvaro Mondéjar
2d91a307b8
Add lint rule to unify self-closing tags format (#6513)
* Add lint rule to unify closing tags format

* Apply suggestions from code review

* Simplify lint rule logic

* Clarify error message

* Fix 'extraneous' rule and remove part of 'svg-format'

Co-authored-by: Eric Cornelissen <ericornelissen@gmail.com>
2021-09-14 22:40:48 +02:00
Álvaro Mondéjar
8dc6c821d6
Update 'svg-path-bbox' to v1.0.0 (#5846)
Co-authored-by: Peter Noble <petershaggynoble@gmail.com>
2021-06-03 20:15:21 +01:00
Álvaro Mondéjar
797a34a2d7
Fix error in 'icon-precision' lint rule (#5842) 2021-06-03 11:12:39 +01:00
Peter Noble
521c96fd04
Remove "icon" suffix from SVG titles (#5616) 2021-05-26 22:20:20 +02:00
Álvaro Mondéjar
a4276d1915
Update Elsevier; fix edge case error in 'collinear segments' lint rule (#5175) 2021-03-10 17:52:08 +00:00
Álvaro Mondéjar
d56a2b3b9d
Add proper error messages to linter; fix bug in 'collinear-segments' rule (#5061)
* Implement better linter error handling; fix error in 'collinear-segments' lint rule

* Revert changes

* Fix error with resolution tips

* Fix lint error

* Fix minor errors

* Increase performance bumping svg-path-segments version

* Minor change in function name and bump svg-path-segments to 0.1.5

* Update function doc

* Remove 'segmentsSVGPath' function and update functions documentation

* Fix error in index number

* Fix automatic collinear segment
2021-03-02 19:00:18 +01:00
Álvaro Mondéjar
078ad4d714
Ensure that icon paths start with moveto command (#5069) 2021-02-22 17:20:07 +01:00
Eric Cornelissen
a4ca74602f
Minor improvements (#4708)
* Remove .travis.yml reference from .gitattributes

* Minor refactoring of .svglintrc.js

- Remove unused variables
- Fix missing semi-colons
- Remove unneeded indentation

* Prevent error in clean command due to missing files

* Fix indentations

* Further improvements to Editorconfig and indentation

* Format YAML files

- Update indentation for array notation
- Normalize use of newlines
2021-01-15 21:47:00 +01:00
Álvaro Mondéjar
d6ee5f47d5
Fix absolute coordinate error in 'collinear-segments' lint (#4692)
* Fix absolute coordinate error in 'collinear-segments' lint

* Add New Japan Pro-Wrestling to 'svglint-ignored.json'
2021-01-15 11:16:50 +01:00
Álvaro Mondéjar
c7734830f0
Fix error in 'collinear-segments' lint (#4604) 2021-01-04 10:05:20 +00:00
Álvaro Mondéjar
45130ca86a
Lint collinear coordinates inside straight lines (#4589) 2021-01-03 17:08:06 +00:00
Álvaro Mondéjar
5b0d1d3e49
Fix variable reference error in 'ineffective-segments' lint (#4585)
* Fix error in ineffective-segments lint

* Update '.svglint-ignored.json'
2021-01-03 10:21:29 -05:00
Álvaro Mondéjar
80594c4045
Unify 'svgpath' calls in linter (#4427) 2020-12-22 09:39:08 -05:00
Álvaro Mondéjar
fb2e2b6cd0
Add lint rule to prohibit negative zeros within paths (#4350)
* Add lint to check negative zeros in paths

* Bump minimum NodeJS version to test locally to v12.4.0

* Simplify regular expression

* Add resolution tip to error message

* Convert iterator to array directly

* Improve comment

* Remove GodotEngine from lint ignores file

* Improve resolution tip message if previous character is a number
2020-12-14 20:35:27 +01:00
Alexandre Paradis
a6d90e24e4
Add a new linter rule for ineffective commands in paths (#4262)
* Add a new linter rule for invalid command in path

* Add other ineffective paths

* Imrpove path validation linter

* Relative h/v have a single corrdinate

* Concatenation instead of Template Use string

* Rebase on develop

* Add absolute direction check

* Use absolute coordinate to compare with previous

* Rebase

* Rename arrays with plural

* Loop back until we have missing coordinates to compare

* Rebase on develop

* Rename to ineffective-segments

* Rebase on develop

* Manage relative Bézier Curve and Shorthand curve

* Manage absolute Bézier Curve and Shorthand curve

* Fix Shorthand curve verification

* Rebase on develop

* Fix from review

* fix brain
2020-12-13 14:29:01 -05:00
Álvaro Mondéjar
01a4d7fa30
Replace 'svg-path-bounding-box' with 'svg-path-bbox'. (#3977)
* Replace 'svg-path-bounding-box' with 'svg-path-bbox'.

* Decompose bounding boxes calling 'svgPathBbox'

* Add 'icon-precision' list to '.svglint-ignored.json'

* Downgrade 'package-lock.json' lockVersion file to 1.

* Update 'svglint-ignored.json'

* Update dependencies
2020-11-23 11:36:10 +01:00
Álvaro Mondéjar
fdb7f86566
Upgrade svglint to prevent silent exceptions (#3985)
* Upgrade svglint to prevent silent exceptions

* Update package-lock.json

* Downgrade package-lock.json lockfile vesion
2020-11-22 11:01:20 +01:00
Alexandre Paradis
9cee719fcb
Proposal: Check outlying precision while running linter (#3750)
* Check outlying precision while running linter

* Prevent reduce error on empty array

* Rebase on branch develop

* Add svgpath dep

* Improve decimal precision verification

* Check outlying precision while running linter

* Prevent reduce error on empty array

* Fix ignored file

* Fix reverted dep version

* Check decimal according to review proposal

* Pin svgpath version

* Use te maximum precision only

* Run linter again

* Fix uglify-js version

* Add supported engines to package.json

* Improve message

* Revert engines and use version check in linter

* Move function

* Update node version to 12 in Travis

* Add skip ignored
2020-11-19 21:49:49 +01:00
Eric Cornelissen
8b2ae9b780 Hotfix .svglintrc.js
There was a minor error in .svglintrc.js that caused it to silently
fail in the size and centered checks due to a mistake in the `isIgnored`
function.
2020-10-29 23:03:24 +02:00
David Beitey
c290479a78
Update svglint ignore list, add ignore list updater (#3433)
This updates the ignore list as per #3250 and embeds code for updating
the ignore file when the environment variable `SI_UPDATE_IGNORE=true`
is set and the linter is run like so `SI_UPDATE_IGNORE=true npm run svglint`
-- running this command will display all remaining linting failures and
use these to update the ignore file.

This also:

* Normalises the top-level object key in the ignore file to match each
  linter name
* Sorts the ignore output on top-level key and icon name value to
  make output consistent
* Speeds up icon center checking if ignored
* Ignores icons in size linter if icon is otherwise ignored
2020-10-17 13:01:56 +02:00
Eric Cornelissen
7fb4ff6395
Fix low severity issues in the JavaScript (#3342) 2020-07-28 11:33:40 +01:00
David Beitey
cc509d9246
Add svg linter to check center (#3250)
This adds a tolerance of +/- 0.001 to either the X or Y dimensions,
adjusting the existing ignore list and size linter to fit the new
structure of the ignore file.

See https://github.com/simple-icons/simple-icons/pull/3107#issuecomment-648089119
2020-07-10 11:06:08 +03:00
Peter Noble
6a2e8ca4a3
Remove extraneous spaces from icon markup (#3256)
* Remove extraneous spaces from icon markup

* Add linting check for excess whitespace
2020-07-05 15:57:00 +02:00
Eric Cornelissen
01221c047d
Add linting step for extraneous elements in SVGs (#3239)
* Add linting step for extraneous elements in SVGs

... such as a trailing "s" in the Quasar SVG (#3221)

* Remove trailing space from BMC Software icon

* Improve error message for violations

Co-authored-by: Peter Noble <PeterShaggyNoble@users.noreply.github.com>
Co-authored-by: Lucas Becker <runxel@users.noreply.github.com>
2020-06-22 18:24:56 +02:00
David Beitey
5da34c7efd
Add linter to check svg path dimensions (#3107)
* Add linter to check svg path dimensions

Float precision is set at 3 which is the default for svgo in .svgo.yml;
precision can be raised over time.

This adds an ignore file with the current paths of non-conforming icons.

This also changes the name of the icon title linter as well so it reads
more nicely than "custom".

* Update CONTRIBUTING GUIDELINES

Add a note on visual imperfections and viewbox problems due to 
optimizing.

Co-authored-by: Eric Cornelisesn <ericornelissen@gmail.com>
Co-authored-by: Peter Noble <PeterShaggyNoble@users.noreply.github.com>
2020-06-10 12:59:42 +03:00
Eric Cornelissen
287317b7b6 Lint the SVG's title content (#1508)
* Add custom SVGLint rule to lint the general <title> format

i.e. the <title> should be "[ICON_NAME] icon"

* Check if there exists an entry in simple-icons.json with the icon name

... found in the <title>

* Normalize all icons <title> value

* Fix mismatch between HTML's icon title and simple-icons.json title

... due to HTML special entities (such as `&amp;`). Affected icons:

- AT&T (AT&amp;T)
- Let's Encrypt (Let&apos;s Encrypt)

* Refactor .svglintrc.js

to make the code style more in line with scripts/prepublish.js

* Add SVG with invalid <title> format

* Add SVG with unknown title

* Revert 6912816 and f002504
2019-07-03 23:33:03 +02:00
David Klebanoff
1c0b2b1dbf Update SVG linting. Only single path SVGs allowed. (#1335)
* Update SVG linting. Only single path SVGs allowed.

* Update docs.
2019-03-28 21:40:31 +02:00
David Klebanoff
450cfbc9ad Update lint rules for SVG paths. (#1304) 2019-03-20 09:55:03 +02:00
Eric Cornelissen
4b882220ef Remove aria-labelledby and ids from SVGs (#1062)
* Remove `id` and `aria-labelledby` from all SVGs

* Update SVGLint configuration

* Remove `aria-labelledby` from documentation

* Remove `aria-labelledby` from website

because why not
2018-11-06 17:10:17 +01:00
Johan Fagerberg
289d1883a1 Add SVGLint (#922)
* Added SVGLint

* Added SVGLint to CI

* Upgraded Node version used by CI

* Upgraded SVGLint to latest version

* Moved SVGLint configuration file

* Upgraded SVGLint

1.0.1 -> 1.0.2
Adds support for globs on Windows

* Added SVGLint check for aria-labelledby and title ID
2018-08-16 11:33:32 +02:00