Skip to content

Commit 006ccb2

Browse files
committed
feat: update prettier rules/config
1 parent 99237e3 commit 006ccb2

File tree

12 files changed

+45
-35
lines changed

12 files changed

+45
-35
lines changed

.editorconfig

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
root = true
22

3-
[*.js]
4-
indent_size = 2
5-
indent_style = space
3+
[*]
4+
charset = utf-8
65
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
max_line_length = 80
10+
trim_trailing_whitespace = true

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
.DS_Store
2-
node_modules/
2+
._.DS_Store
3+
Thumbs.db
4+
/.env
5+
/.nvm
6+
/.vscode
7+
/npm-debug.log
8+
/yarn.lock
9+
**/node_modules

.prettierignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Ignore artifacts:
1+
.github/
22
*.json
3-
*.xml
4-
*.yml
53
*.md

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"arrowParens": "avoid",
3+
"semi": false,
4+
"singleQuote": true,
5+
"trailingComma": "none",
6+
"proseWrap": "always"
7+
}

.prettierrc.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

scripts/update-data-npm.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function pFilterChunk(chunks, callbackFn, options) {
5656
} else {
5757
const chunk = chunks[i]
5858
const predicateResults = await Promise.all(
59-
chunk.map((value) => {
59+
chunk.map(value => {
6060
if (signal?.aborted) {
6161
return Promise.resolve()
6262
}
@@ -96,7 +96,7 @@ void (async () => {
9696
])
9797
]
9898
const rawLegacyNames = allThePackageNames
99-
.filter((n) => !validateNpmPackageName(n).validForNewPackages)
99+
.filter(n => !validateNpmPackageName(n).validForNewPackages)
100100
.sort(alphanumericComparator)
101101
const seenNames = new Set()
102102
const invalidNames = new Set()
@@ -105,7 +105,7 @@ void (async () => {
105105
await pFilter(
106106
rawLegacyNames,
107107
3,
108-
async (n) => {
108+
async n => {
109109
if (!seenNames.has(n)) {
110110
seenNames.add(n)
111111
spinner.text = `Checking package ${n}...`
@@ -126,7 +126,7 @@ void (async () => {
126126
[
127127
{ json: builtinNames, path: npmBuiltinNamesJsonPath },
128128
{ json: legacyNames, path: npmLegacyNamesJsonPath }
129-
].map((d) =>
129+
].map(d =>
130130
fs.writeFile(d.path, `${JSON.stringify(d.json, null, 2)}\n`, 'utf8')
131131
)
132132
)

src/package-url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ class PackageURL {
232232
let rawQualifiers
233233
const { searchParams } = url
234234
if (searchParams.size !== 0) {
235-
searchParams.forEach((value) =>
235+
searchParams.forEach(value =>
236236
decodePurlComponent('qualifiers', value)
237237
)
238238
// Split the remainder once from right on '?'.

src/purl-component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ const {
3232
validateSubpath
3333
} = require('./validate')
3434

35-
const PurlComponentEncoder = (comp) =>
35+
const PurlComponentEncoder = comp =>
3636
isNonEmptyString(comp) ? encodeURIComponent(comp) : ''
3737

38-
const PurlComponentStringNormalizer = (comp) =>
38+
const PurlComponentStringNormalizer = comp =>
3939
typeof comp === 'string' ? comp : undefined
4040

4141
const PurlComponentValidator = (_comp, _throws) => true

src/purl-type.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const {
1414
const { validateEmptyByType, validateRequiredByType } = require('./validate')
1515
const { PurlError } = require('./error')
1616

17-
const PurlTypNormalizer = (purl) => purl
17+
const PurlTypNormalizer = purl => purl
1818
const PurlTypeValidator = (_purl, _throws) => true
1919

2020
const getNpmBuiltinNames = (() => {
@@ -48,9 +48,9 @@ function getNpmId(purl) {
4848
return `${namespace?.length > 0 ? `${namespace}/` : ''}${name}`
4949
}
5050

51-
const isNpmBuiltinName = (id) => getNpmBuiltinNames().includes(id.toLowerCase())
51+
const isNpmBuiltinName = id => getNpmBuiltinNames().includes(id.toLowerCase())
5252

53-
const isNpmLegacyName = (id) => getNpmLegacyNames().includes(id)
53+
const isNpmLegacyName = id => getNpmLegacyNames().includes(id)
5454

5555
module.exports = {
5656
// PURL types:

0 commit comments

Comments
 (0)