Skip to content

Commit d2937e9

Browse files
committed
fix lintfix script, use flat ternaries
1 parent e3495cc commit d2937e9

15 files changed

+28
-28
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"ArrayExpression": 1,
6363
"ObjectExpression": 1,
6464
"ImportDeclaration": 1,
65-
"flatTernaryExpressions": false,
65+
"flatTernaryExpressions": true,
6666
"ignoreComments": false,
6767
"ignoredNodes": ["TemplateLiteral *"]
6868
}],

lib/config/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Object.defineProperty(exports, 'defaults', {
158158
globalconfig: path.resolve(globalPrefix, 'etc', 'npmrc'),
159159
'global-style': false,
160160
group: process.platform === 'win32' ? 0
161-
: process.env.SUDO_GID || (process.getgid && process.getgid()),
161+
: process.env.SUDO_GID || (process.getgid && process.getgid()),
162162
'ham-it-up': false,
163163
heading: 'npm',
164164
'if-present': false,

lib/config/flat-options.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ const flatOptions = npm => npm.flatOptions || Object.freeze({
175175
saveType: npm.config.get('save-optional') && npm.config.get('save-peer')
176176
? 'peerOptional'
177177
: npm.config.get('save-optional') ? 'optional'
178-
: npm.config.get('save-dev') ? 'dev'
179-
: npm.config.get('save-peer') ? 'peer'
180-
: npm.config.get('save-prod') ? 'prod'
181-
: null,
178+
: npm.config.get('save-dev') ? 'dev'
179+
: npm.config.get('save-peer') ? 'peer'
180+
: npm.config.get('save-prod') ? 'prod'
181+
: null,
182182
savePrefix: npm.config.get('save-exact') ? ''
183-
: npm.config.get('save-prefix'),
183+
: npm.config.get('save-prefix'),
184184

185185
// configs for npm-registry-fetch
186186
otp: npm.config.get('otp'),

lib/config/set-envs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const envVal = val => Array.isArray(val) ? val.join('\n\n') : val
1616

1717
const sameConfigValue = (def, val) =>
1818
!Array.isArray(val) || !Array.isArray(def) ? def === val
19-
: sameArrayValue(def, val)
19+
: sameArrayValue(def, val)
2020

2121
const sameArrayValue = (def, val) => {
2222
if (def.length !== val.length) {

lib/explore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const explore = async args => {
5151
output(`\nExploring ${cwd}\nType 'exit' or ^D when finished\n`)
5252
}
5353

54-
log.silly('explore', {sh, shellArgs, opts})
54+
log.silly('explore', { sh, shellArgs, opts })
5555

5656
// only noisily fail if non-interactive, but still keep exit code intact
5757
const proc = spawn(sh, shellArgs, opts)

lib/help-search.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ function searchFiles (args, files, cb) {
145145
results = results.sort(function (a, b) {
146146
return a.found.length > b.found.length ? -1
147147
: a.found.length < b.found.length ? 1
148-
: a.totalHits > b.totalHits ? -1
149-
: a.totalHits < b.totalHits ? 1
150-
: a.lines.length > b.lines.length ? -1
151-
: a.lines.length < b.lines.length ? 1
152-
: 0
148+
: a.totalHits > b.totalHits ? -1
149+
: a.totalHits < b.totalHits ? 1
150+
: a.lines.length > b.lines.length ? -1
151+
: a.lines.length < b.lines.length ? 1
152+
: 0
153153
})
154154

155155
cb(null, results)

lib/help.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function pickMan (mans, pref_) {
102102
var bn = b.match(nre)[1]
103103
return an === bn ? (a > b ? -1 : 1)
104104
: pref[an] < pref[bn] ? -1
105-
: 1
105+
: 1
106106
})
107107
return mans[0]
108108
}

lib/outdated.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ async function outdated_ (tree, deps, opts) {
134134

135135
const type = edge.optional ? 'optionalDependencies'
136136
: edge.peer ? 'peerDependencies'
137-
: edge.dev ? 'devDependencies'
138-
: 'dependencies'
137+
: edge.dev ? 'devDependencies'
138+
: 'dependencies'
139139

140140
// deps different from prod not currently
141141
// on disk are not included in the output

lib/repo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const getRepo = async pkg => {
2626
const r = mani.repository
2727
const rurl = !r ? null
2828
: typeof r === 'string' ? r
29-
: typeof r === 'object' && typeof r.url === 'string' ? r.url
30-
: null
29+
: typeof r === 'object' && typeof r.url === 'string' ? r.url
30+
: null
3131

3232
if (!rurl) {
3333
throw Object.assign(new Error('no repository'), {

lib/utils/escape-arg.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ block, creates a new " quoted string with ' in it. So, `foo'bar` becomes
1414
*/
1515

1616
module.exports = str => isWindows ? '"' + normalize(str) + '"'
17-
: /[^-_.~/\w]/.test(str) ? "'" + str.replace(/'/g, `'"'"'`) + "'"
17+
: /[^-_.~/\w]/.test(str) ? "'" + str.replace(/'/g, '\'"\'"\'') + "'"
1818
: str

0 commit comments

Comments
 (0)