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 charset=utf-8
insert_final_newline=true
[LICENSE.md]
indent_size=unset
indent_style=space
[*.{json,yml}]
indent_size=2 indent_size=2
indent_style=space indent_style=space
insert_final_newline=true
trim_trailing_whitespace=true
[*.md]
indent_size=unset
[*.svg] [*.svg]
insert_final_newline=false insert_final_newline=false
@ -20,4 +18,6 @@ trim_trailing_whitespace=false # Templates with trailing whitespace are more usa
[_data/simple-icons.json] [_data/simple-icons.json]
indent_size=4 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 # Don't export/archive these files
.github export-ignore .github export-ignore
.gitpod.yml export-ignore .gitpod.yml export-ignore
.travis.yml export-ignore
CNAME export-ignore CNAME export-ignore

4
.github/labeler.yml vendored
View file

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

View file

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

View file

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

View file

@ -31,7 +31,7 @@
}, },
"scripts": { "scripts": {
"build": "node scripts/build-package.js", "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", "lint": "run-s our-lint jsonlint svglint wslint",
"our-lint": "node scripts/lint.js", "our-lint": "node scripts/lint.js",
"jsonlint": "jsonlint _data/simple-icons.json -q -V .jsonlintschema", "jsonlint": "jsonlint _data/simple-icons.json -q -V .jsonlintschema",