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
This commit is contained in:
Eric Cornelissen 2021-01-15 21:47:00 +01:00 committed by GitHub
parent 8fc59f0507
commit a4ca74602f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 185 additions and 188 deletions

View file

@ -2,15 +2,13 @@ root=true
[*]
charset=utf-8
insert_final_newline=true
[LICENSE.md]
indent_size=unset
indent_style=space
[*.{json,yml}]
indent_size=2
indent_style=space
insert_final_newline=true
trim_trailing_whitespace=true
[*.md]
indent_size=unset
[*.svg]
insert_final_newline=false
@ -20,4 +18,6 @@ trim_trailing_whitespace=false # Templates with trailing whitespace are more usa
[_data/simple-icons.json]
indent_size=4
trim_trailing_whitespace=true
[index.html]
indent_size=4

1
.gitattributes vendored
View file

@ -14,5 +14,4 @@ Gemfile.lock -diff
# Don't export/archive these files
.github export-ignore
.gitpod.yml export-ignore
.travis.yml export-ignore
CNAME export-ignore

4
.github/labeler.yml vendored
View file

@ -1,6 +1,6 @@
new icon:
- any: [icons/*.svg]
status: 'added'
status: added
icon outdated:
- any: [icons/*.svg]
status: 'modified'
status: modified

View file

@ -25,7 +25,6 @@ jobs:
out of scope
pending
won't add
remove-closed-pr-labels:
name: Remove closed pull request labels
if: github.event_name == 'pull_request_target' && (! github.event.pull_request.merged)
@ -37,7 +36,6 @@ jobs:
labels: |
in discussion
pending
remove-closed-issue-labels:
name: Remove closed issue labels
if: github.event.issue.state == 'closed'

View file

@ -15,7 +15,7 @@ const iconMaxFloatPrecision = 5;
const iconTolerance = 0.001;
// set env SI_UPDATE_IGNORE to recreate the ignore file
const updateIgnoreFile = process.env.SI_UPDATE_IGNORE === 'true'
const updateIgnoreFile = process.env.SI_UPDATE_IGNORE === 'true';
const ignoreFile = "./.svglint-ignored.json";
const iconIgnored = !updateIgnoreFile ? require(ignoreFile) : {};
@ -224,14 +224,14 @@ module.exports = {
}
}
if (index > 0) {
let [yPrevCoord, xPrevCoord, ...prevRest] = [...absSegments[index - 1]].reverse();
let [yPrevCoord, xPrevCoord] = [...absSegments[index - 1]].reverse();
// If the previous command was a direction one, we need to iterate back until we find the missing coordinates
if (upperDirectionCommands.includes(xPrevCoord)) {
xPrevCoord = undefined;
yPrevCoord = undefined;
let idx = index;
while (--idx > 0 && (xPrevCoord === undefined || yPrevCoord === undefined)) {
let [yPrevCoordDeep, xPrevCoordDeep, ...rest] = [...absSegments[idx]].reverse();
let [yPrevCoordDeep, xPrevCoordDeep] = [...absSegments[idx]].reverse();
// If the previous command was a horizontal movement, we need to consider the single coordinate as x
if (upperHorDirectionCommand === xPrevCoordDeep) {
xPrevCoordDeep = yPrevCoordDeep;
@ -368,7 +368,7 @@ module.exports = {
currAbsCoord = [startPoint[0], startPoint[1]];
_resetStartPoint = true;
} else {
throw new Error(`"${cmd}" command not handled`)
throw new Error(`"${cmd}" command not handled`);
}
if (startPoint === undefined) {
@ -396,7 +396,7 @@ module.exports = {
currLine[p][0],
currLine[p][1],
currLine[p + 1][0],
currLine[p + 1][1])
currLine[p + 1][1]);
if (_collinearCoord) {
collinearSegments.push(segments[s - currLine.length + p + 1]);
}

View file

@ -31,7 +31,7 @@
},
"scripts": {
"build": "node scripts/build-package.js",
"clean": "rm icons/*.js index.js",
"clean": "rm -f icons/*.js index.js",
"lint": "run-s our-lint jsonlint svglint wslint",
"our-lint": "node scripts/lint.js",
"jsonlint": "jsonlint _data/simple-icons.json -q -V .jsonlintschema",