-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update dotfiles, improve lint-staged config
lint-staged now runs prettier on all supported files instead on only predefined file types, see https://maier.tech/posts/optimizing-lint-staged-config-js-for-prettier for more information.
- Loading branch information
1 parent
6c84917
commit 3f67e1b
Showing
7 changed files
with
73 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:import/errors", | ||
"plugin:import/warnings", | ||
"plugin:import/typescript", | ||
"plugin:promise/recommended", | ||
"plugin:unicorn/recommended" | ||
] | ||
"plugin:unicorn/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"unicorn/prefer-node-protocol": "off", | ||
"unicorn/prefer-module": "off", | ||
"unicorn/prevent-abbreviations": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"semi": false, | ||
"arrowParens": "always", | ||
"singleQuote": false, | ||
"tabWidth": 2, | ||
"printWidth": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* eslint-disable no-undef */ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
/* eslint-disable unicorn/prefer-array-flat-map */ | ||
|
||
// Source: https://coding.maier.tech/posts/optimizing-lint-staged-config-js-for-prettier/ | ||
|
||
const micromatch = require("micromatch") | ||
const prettier = require("prettier") | ||
|
||
// Figure out all extensions supported by Prettier. | ||
const prettierSupportedExtensions = prettier | ||
.getSupportInfo() | ||
.languages.map(({ extensions }) => extensions) | ||
.flat() | ||
|
||
const addQuotes = (a) => `"${a}"` | ||
|
||
module.exports = (allStagedFiles) => { | ||
// Match files for ESLint | ||
const eslintFiles = micromatch(allStagedFiles, ["**/*.{js,ts}"], { | ||
dot: true, | ||
}) | ||
|
||
// Match files for Prettier | ||
const prettierFiles = micromatch( | ||
allStagedFiles, | ||
prettierSupportedExtensions.map((extension) => `**/*${extension}`), | ||
{ dot: true } | ||
) | ||
|
||
// Array of linters to be run in this sequence. | ||
const linters = [] | ||
|
||
// Add linters only when there are staged files for them. | ||
// 'prettier --write' causes lint-staged to never terminate when prettierFiles is empty. | ||
|
||
if (eslintFiles.length > 0) linters.push(`eslint --fix ${eslintFiles.join(" ")}`) | ||
|
||
if (prettierFiles.length > 0) | ||
linters.push(`prettier --write ${prettierFiles.map((element) => addQuotes(element)).join(" ")}`) | ||
|
||
return linters | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "r6operators", | ||
"version": "1.6.0", | ||
"version": "2.0.0", | ||
"description": "r6operators is a collection of high-quality vectorized Rainbow Six: Siege Operator icons & metadata for Node.js", | ||
"keywords": [ | ||
"rainbow six siege", | ||
|
@@ -19,7 +19,7 @@ | |
"url": "https://github.com/marcopixel/r6operators.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Marco Vockner <[email protected]>", | ||
"author": "Marco Vockner <[email protected]>", | ||
"contributors": [ | ||
"dtSniper (https://twitter.com/sniperdt)", | ||
"Joey Foo (https://github.com/joeyfoo)", | ||
|
@@ -37,7 +37,7 @@ | |
"build:ts": "tsc", | ||
"clean": "npx rimraf lib src/icons.json", | ||
"lint": "eslint **/*.{js,ts} --ignore-path .gitignore", | ||
"format": "prettier **/* --check --write", | ||
"format": "prettier **/* --ignore-path .gitignore --check --write", | ||
"test": "jest", | ||
"type-check": "tsc --noEmit", | ||
"prepare": "husky install" | ||
|
@@ -48,28 +48,17 @@ | |
"npm-run-all": "^4.1.5" | ||
}, | ||
"devDependencies": { | ||
"@types/cheerio": "^0.22.24", | ||
"@types/jest": "^26.0.20", | ||
"@types/node": "^15.6.1", | ||
"@types/sharp": "^0.28.2", | ||
"@typescript-eslint/eslint-plugin": "^4.16.1", | ||
"@typescript-eslint/parser": "^4.16.1", | ||
"eslint": "^7.21.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"eslint-plugin-unicorn": "^32.0.1", | ||
"@typescript-eslint/eslint-plugin": "^4.26.0", | ||
"@typescript-eslint/parser": "^4.26.0", | ||
"esbuild": "^0.12.2", | ||
"eslint": "^7.28.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-unicorn": "^33.0.1", | ||
"husky": "^6.0.0", | ||
"jest": "^27.0.2", | ||
"lint-staged": "^11.0.0", | ||
"prettier": "^2.2.1", | ||
"sharp": "^0.28.3", | ||
"svgo": "^2.2.1", | ||
"ts-jest": "^27.0.1", | ||
"prettier": "^2.3.0", | ||
"ts-node": "^10.0.0", | ||
"typescript": "^4.2.3" | ||
}, | ||
"lint-staged": { | ||
"*.{js,ts}": "eslint --cache --fix", | ||
"*.--write": "prettier --write" | ||
"typescript": "^4.3.2" | ||
} | ||
} |