Skip to content

Commit d113644

Browse files
committed
Add trailing commas
1 parent dfb4942 commit d113644

24 files changed

+337
-306
lines changed

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"quoteProperties": "asNeeded",
3434
"quoteStyle": "single",
3535
"semicolons": "asNeeded",
36-
"trailingCommas": "none"
36+
"trailingCommas": "all"
3737
}
3838
},
3939
"json": {

eslint.config.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const path = require('node:path')
44

55
const {
66
convertIgnorePatternToMinimatch,
7-
includeIgnoreFile
7+
includeIgnoreFile,
88
} = require('@eslint/compat')
99
const js = require('@eslint/js')
1010
const importXPlugin = require('eslint-plugin-import-x')
@@ -23,7 +23,7 @@ const gitignorePath = path.join(rootPath, GITIGNORE)
2323

2424
const biomeConfig = require(biomeConfigPath)
2525
const nodeGlobalsConfig = Object.fromEntries(
26-
Object.entries(globals.node).map(([k]) => [k, 'readonly'])
26+
Object.entries(globals.node).map(([k]) => [k, 'readonly']),
2727
)
2828

2929
module.exports = [
@@ -32,7 +32,7 @@ module.exports = [
3232
name: 'Imported biome.json ignore patterns',
3333
ignores: biomeConfig.files.includes
3434
.filter(p => p.startsWith('!'))
35-
.map(p => convertIgnorePatternToMinimatch(p.slice(1)))
35+
.map(p => convertIgnorePatternToMinimatch(p.slice(1))),
3636
},
3737
{
3838
...js.configs.recommended,
@@ -48,22 +48,22 @@ module.exports = [
4848
...importXPlugin.flatConfigs.recommended.languageOptions?.globals,
4949
...nodePlugin.configs['flat/recommended-script'].languageOptions
5050
?.globals,
51-
...nodeGlobalsConfig
51+
...nodeGlobalsConfig,
5252
},
53-
sourceType: 'script'
53+
sourceType: 'script',
5454
},
5555
linterOptions: {
5656
...js.configs.recommended.linterOptions,
5757
...importXPlugin.flatConfigs.recommended.linterOptions,
5858
...nodePlugin.configs['flat/recommended-script'].linterOptions,
59-
reportUnusedDisableDirectives: 'off'
59+
reportUnusedDisableDirectives: 'off',
6060
},
6161
plugins: {
6262
...js.configs.recommended.plugins,
6363
...importXPlugin.flatConfigs.recommended.plugins,
6464
...nodePlugin.configs['flat/recommended-script'].plugins,
6565
'sort-destructure-keys': sortDestructureKeysPlugin,
66-
unicorn: unicornPlugin
66+
unicorn: unicornPlugin,
6767
},
6868
rules: {
6969
...js.configs.recommended.rules,
@@ -76,8 +76,8 @@ module.exports = [
7676
cjs: 'ignorePackages',
7777
js: 'ignorePackages',
7878
json: 'always',
79-
mjs: 'ignorePackages'
80-
}
79+
mjs: 'ignorePackages',
80+
},
8181
],
8282
'import-x/no-named-as-default-member': 'off',
8383
'import-x/no-unresolved': ['error', { commonjs: true }],
@@ -89,20 +89,20 @@ module.exports = [
8989
'external',
9090
'internal',
9191
['parent', 'sibling', 'index'],
92-
'type'
92+
'type',
9393
],
9494
pathGroups: [
9595
{
9696
pattern: '@socket{registry,security}/**',
97-
group: 'internal'
98-
}
97+
group: 'internal',
98+
},
9999
],
100100
pathGroupsExcludedImportTypes: ['type'],
101101
'newlines-between': 'always',
102102
alphabetize: {
103-
order: 'asc'
104-
}
105-
}
103+
order: 'asc',
104+
},
105+
},
106106
],
107107
'n/exports-style': ['error', 'module.exports'],
108108
// The n/no-unpublished-bin rule does does not support non-trivial glob
@@ -116,8 +116,8 @@ module.exports = [
116116
{
117117
ignores: ['test', 'test.describe'],
118118
// Lazily access constants.maintainedNodeVersions.
119-
version: constants.maintainedNodeVersions.current
120-
}
119+
version: constants.maintainedNodeVersions.current,
120+
},
121121
],
122122
'n/prefer-node-protocol': 'error',
123123
'unicorn/consistent-function-scoping': 'error',
@@ -133,20 +133,20 @@ module.exports = [
133133
{
134134
argsIgnorePattern: '^_|^this$',
135135
ignoreRestSiblings: true,
136-
varsIgnorePattern: '^_'
137-
}
136+
varsIgnorePattern: '^_',
137+
},
138138
],
139139
'no-var': 'error',
140140
'no-warning-comments': ['warn', { terms: ['fixme'] }],
141141
'prefer-const': 'error',
142142
'sort-destructure-keys/sort-destructure-keys': 'error',
143-
'sort-imports': ['error', { ignoreDeclarationSort: true }]
144-
}
143+
'sort-imports': ['error', { ignoreDeclarationSort: true }],
144+
},
145145
},
146146
{
147147
files: ['**/*.mjs'],
148148
languageOptions: {
149-
sourceType: 'module'
150-
}
151-
}
149+
sourceType: 'module',
150+
},
151+
},
152152
]

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ const {
2525
PackageURL,
2626
PurlComponent,
2727
PurlQualifierNames,
28-
PurlType
28+
PurlType,
2929
} = require('./src/package-url')
3030

3131
module.exports = {
3232
PackageURL,
3333
PurlComponent,
3434
PurlQualifierNames,
35-
PurlType
35+
PurlType,
3636
}

scripts/get-coverage-percentage.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function logCoveragePercentage(argv) {
2424
const coverageJsonPath = path.join(
2525
process.cwd(),
2626
'coverage',
27-
'coverage-final.json'
27+
'coverage-final.json',
2828
)
2929

3030
if (!existsSync(coverageJsonPath)) {
@@ -34,7 +34,7 @@ async function logCoveragePercentage(argv) {
3434
try {
3535
result = await spawn('pnpm', ['run', 'test:unit:coverage'], {
3636
stdio: 'ignore',
37-
shell: constants.WIN32
37+
shell: constants.WIN32,
3838
})
3939
} catch (error) {
4040
spinner.stop()
@@ -146,44 +146,44 @@ async function logCoveragePercentage(argv) {
146146
statements: {
147147
percent: stmtPercent,
148148
covered: coveredStatements,
149-
total: totalStatements
149+
total: totalStatements,
150150
},
151151
branches: {
152152
percent: branchPercent,
153153
covered: coveredBranches,
154-
total: totalBranches
154+
total: totalBranches,
155155
},
156156
functions: {
157157
percent: funcPercent,
158158
covered: coveredFunctions,
159-
total: totalFunctions
159+
total: totalFunctions,
160160
},
161161
lines: {
162162
percent: linePercent,
163163
covered: coveredLines,
164-
total: totalLines
164+
total: totalLines,
165165
},
166-
overall: overall
166+
overall: overall,
167167
},
168168
null,
169-
2
170-
)
169+
2,
170+
),
171171
)
172172
} else if (argv.simple) {
173173
logger.log(stmtPercent)
174174
} else {
175175
logger.info(`Coverage Summary:`)
176176
logger.info(
177-
`${indent}Statements: ${stmtPercent}% (${coveredStatements}/${totalStatements})`
177+
`${indent}Statements: ${stmtPercent}% (${coveredStatements}/${totalStatements})`,
178178
)
179179
logger.info(
180-
`${indent}Branches: ${branchPercent}% (${coveredBranches}/${totalBranches})`
180+
`${indent}Branches: ${branchPercent}% (${coveredBranches}/${totalBranches})`,
181181
)
182182
logger.info(
183-
`${indent}Functions: ${funcPercent}% (${coveredFunctions}/${totalFunctions})`
183+
`${indent}Functions: ${funcPercent}% (${coveredFunctions}/${totalFunctions})`,
184184
)
185185
logger.info(
186-
`${indent}Lines: ${linePercent}% (${coveredLines}/${totalLines})`
186+
`${indent}Lines: ${linePercent}% (${coveredLines}/${totalLines})`,
187187
)
188188
logger.info('')
189189
logger.info(colors.bold(`Current coverage: ${overall}% overall!${emoji}`))
@@ -195,8 +195,8 @@ void (async () => {
195195
boolean: ['json', 'simple'],
196196
alias: {
197197
j: 'json',
198-
s: 'simple'
199-
}
198+
s: 'simple',
199+
},
200200
})
201201
await logCoveragePercentage(argv)
202202
})()

scripts/update-data-npm.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void (async () => {
3535
if (
3636
await confirm({
3737
message: `Update builtin package names?${isGteNext ? '' : ` (Requires Node >=${next})`}`,
38-
default: true
38+
default: true,
3939
})
4040
) {
4141
const nodeVersion = process.version.slice(1)
@@ -54,7 +54,7 @@ void (async () => {
5454
if (
5555
!(await confirm({
5656
message: 'Update npm package names data?',
57-
default: false
57+
default: false,
5858
}))
5959
) {
6060
spinner.stop()
@@ -69,8 +69,8 @@ void (async () => {
6969
// Load the 24.7MB names.json from '[email protected]',
7070
// the last v1 release, because it has different names resolved by
7171
// npm's replicate.npmjs.com service.
72-
...require('all-the-package-names-v1.3905.0/names.json')
73-
])
72+
...require('all-the-package-names-v1.3905.0/names.json'),
73+
]),
7474
]
7575
const rawLegacyNames = allThePackageNames
7676
// Don't simply check validateNpmPackageName(n).validForOldPackages.
@@ -98,7 +98,7 @@ void (async () => {
9898
}
9999
return false
100100
},
101-
{ concurrency: 3, retries: 4, signal: abortSignal }
101+
{ concurrency: 3, retries: 4, signal: abortSignal },
102102
)
103103
await writeJson(npmLegacyNamesJsonPath, legacyNames, { spaces: 2 })
104104
spinner.stop()

src/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ module.exports = {
1212
LOOP_SENTINEL,
1313
REUSED_SEARCH_PARAMS,
1414
REUSED_SEARCH_PARAMS_KEY,
15-
REUSED_SEARCH_PARAMS_OFFSET
15+
REUSED_SEARCH_PARAMS_OFFSET,
1616
}

src/decode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ function decodePurlComponent(comp, encodedComponent) {
1414
}
1515

1616
module.exports = {
17-
decodePurlComponent
17+
decodePurlComponent,
1818
}

src/encode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const {
44
REUSED_SEARCH_PARAMS,
55
REUSED_SEARCH_PARAMS_KEY,
6-
REUSED_SEARCH_PARAMS_OFFSET
6+
REUSED_SEARCH_PARAMS_OFFSET,
77
} = require('./constants')
88
const { isObject } = require('./objects')
99
const { isNonEmptyString } = require('./strings')
@@ -81,5 +81,5 @@ module.exports = {
8181
encodeVersion,
8282
encodeQualifiers,
8383
encodeQualifierParam,
84-
encodeSubpath
84+
encodeSubpath,
8585
}

src/error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ class PurlError extends Error {
3030

3131
module.exports = {
3232
formatPurlErrorMessage,
33-
PurlError
33+
PurlError,
3434
}

src/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function createHelpersNamespaceObject(helpers, options_ = {}) {
44
const { comparator, ...defaults } = { __proto__: null, ...options_ }
55
const helperNames = Object.keys(helpers).sort()
66
const propNames = [
7-
...new Set(Object.values(helpers).flatMap(Object.keys))
7+
...new Set(Object.values(helpers).flatMap(Object.keys)),
88
].sort(comparator)
99
const nsObject = Object.create(null)
1010
for (let i = 0, { length } = propNames; i < length; i += 1) {
@@ -23,5 +23,5 @@ function createHelpersNamespaceObject(helpers, options_ = {}) {
2323
}
2424

2525
module.exports = {
26-
createHelpersNamespaceObject
26+
createHelpersNamespaceObject,
2727
}

0 commit comments

Comments
 (0)