Skip to content

Commit

Permalink
Merge pull request #18 from atom-community/eslint
Browse files Browse the repository at this point in the history
fix: run eslint fix
  • Loading branch information
aminya authored Jul 23, 2021
2 parents 02c8796 + 5a89c22 commit b35898a
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions spec/init-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ describe("apm init", function () {
"https://github.com/somebody/fake-package"
)
expect(
CSON.readFileSync(path.join(packagePath, "snippets", "fake-package.cson"))[".source.rd.tm"]["Attach"]
CSON.readFileSync(path.join(packagePath, "snippets", "fake-package.cson"))[".source.rd.tm"].Attach
).toEqual({
body: "attach($1) *outlet",
prefix: "att",
})
return expect(
CSON.readFileSync(path.join(packagePath, "settings", "fake-package.cson"))[".source.r"]["editor"]
CSON.readFileSync(path.join(packagePath, "settings", "fake-package.cson"))[".source.r"].editor
).toEqual({
decreaseIndentPattern: "^\\s*\\}",
foldEndPattern: "(^\\s*\\)|^\\s*\\})",
Expand Down
2 changes: 1 addition & 1 deletion src/apm.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function isWin32() {
}

export function x86ProgramFilesDirectory() {
return process.env["ProgramFiles(x86)"] || process.env["ProgramFiles"]
return process.env["ProgramFiles(x86)"] || process.env.ProgramFiles
}

export function getInstalledVisualStudioFlag() {
Expand Down
2 changes: 1 addition & 1 deletion src/dedupe.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ This command is experimental.\
dedupeArgs.push("--quiet")
}

for (let packageName of options.argv._) {
for (const packageName of options.argv._) {
dedupeArgs.push(packageName)
}

Expand Down
2 changes: 1 addition & 1 deletion src/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const addPortableGitToEnv = function (env) {
return
}

for (let child of Array.from(children)) {
for (const child of Array.from(children)) {
if (child.indexOf("PortableGit_") === 0) {
const cmdPath = path.join(githubPath, child, "cmd")
const binPath = path.join(githubPath, child, "bin")
Expand Down
8 changes: 4 additions & 4 deletions src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ on the option selected.\

return (() => {
const result = []
for (let childPath of fs.listRecursive(templatePath)) {
for (const childPath of fs.listRecursive(templatePath)) {
const templateChildPath = path.resolve(templatePath, childPath)
let relativePath = templateChildPath.replace(templatePath, "")
relativePath = relativePath.replace(/^\//, "")
Expand Down Expand Up @@ -176,7 +176,7 @@ on the option selected.\
}

replacePackageNamePlaceholders(string, packageName) {
const placeholderRegex = /__(?:(package-name)|([pP]ackageName)|(package_name))__/g
const placeholderRegex = /__(?:(package-name)|([Pp]ackageName)|(package_name))__/g
return (string = string.replace(placeholderRegex, (match, dash, camel, underscore) => {
if (dash) {
return this.dasherize(packageName)
Expand Down Expand Up @@ -209,7 +209,7 @@ on the option selected.\
string = string[0].toLowerCase() + string.slice(1)
return string.replace(/([A-Z])|(_)/g, function (m, letter, underscore) {
if (letter) {
return "-" + letter.toLowerCase()
return `-${letter.toLowerCase()}`
} else {
return "-"
}
Expand All @@ -224,7 +224,7 @@ on the option selected.\
string = string[0].toLowerCase() + string.slice(1)
return string.replace(/([A-Z])|(-)/g, function (m, letter, dash) {
if (letter) {
return "_" + letter.toLowerCase()
return `_${letter.toLowerCase()}`
} else {
return "_"
}
Expand Down
6 changes: 3 additions & 3 deletions src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ Run apm -v after installing Git to see what version has been detected.\
options = _.extend({}, options, { installGlobally: false })
const commands = []
const object = this.getPackageDependencies()
for (let name in object) {
for (const name in object) {
const version = object[name]
;((name, version) => {
return commands.push((next) => {
Expand Down Expand Up @@ -462,7 +462,7 @@ Run apm -v after installing Git to see what version has been detected.\
// normalized repo-local package path entry in the `dependencies` section of
// `package.json`. Versioned `packageDependencies` are always returned.
const filteredPackages = {}
for (let packageName in packageDependencies) {
for (const packageName in packageDependencies) {
const packageSpec = packageDependencies[packageName]
const dependencyPath = this.getRepoLocalPackagePath(dependencies[packageName])
const packageDependencyPath = this.getRepoLocalPackagePath(packageSpec)
Expand Down Expand Up @@ -593,7 +593,7 @@ Run apm -v after installing Git to see what version has been detected.\

let latestVersion = null
const object = pack.versions != null ? pack.versions : {}
for (let version in object) {
for (const version in object) {
const metadata = object[version]
if (!semver.valid(version)) {
continue
Expand Down
2 changes: 1 addition & 1 deletion src/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ List all of the symlinked atom packages in ~/.atom/packages and

getSymlinks(directoryPath) {
const symlinks = []
for (let directory of fs.list(directoryPath)) {
for (const directory of fs.list(directoryPath)) {
const symlinkPath = path.join(directoryPath, directory)
if (fs.isSymbolicLinkSync(symlinkPath)) {
symlinks.push(symlinkPath)
Expand Down
6 changes: 3 additions & 3 deletions src/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ List all the installed packages and also the packages bundled with Atom.\
if (options.argv.bare) {
return (() => {
const result = []
for (let pack of packages) {
for (const pack of packages) {
let packageLine = pack.name
if (pack.version != null && options.argv.versions) {
packageLine += `@${pack.version}`
Expand Down Expand Up @@ -121,7 +121,7 @@ List all the installed packages and also the packages bundled with Atom.\

listPackages(directoryPath, options) {
const packages = []
for (let child of fs.list(directoryPath)) {
for (const child of fs.list(directoryPath)) {
var manifestPath
if (!fs.isDirectorySync(path.join(directoryPath, child))) {
continue
Expand Down Expand Up @@ -202,7 +202,7 @@ List all the installed packages and also the packages bundled with Atom.\
}
let packages = (() => {
const result = []
for (let packageName in _atomPackages) {
for (const packageName in _atomPackages) {
;({ metadata } = _atomPackages[packageName])
result.push(metadata)
}
Expand Down
18 changes: 9 additions & 9 deletions src/package-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class PackageConverter {
convertSettings(settings) {
if (settings.shellVariables) {
const shellVariables = {}
for (let { name, value } of settings.shellVariables) {
for (const { name, value } of settings.shellVariables) {
shellVariables[name] = value
}
settings.shellVariables = shellVariables
Expand Down Expand Up @@ -150,11 +150,11 @@ export default class PackageConverter {

return (() => {
const result = []
for (let child of fs.readdirSync(directoryPath)) {
for (const child of fs.readdirSync(directoryPath)) {
const childPath = path.join(directoryPath, child)

// Invalid characters taken from http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
let convertedFileName = child.replace(/[|?*<>:"\\\/]+/g, "-")
let convertedFileName = child.replace(/["*/:<>?\\|]+/g, "-")
if (child === convertedFileName) {
continue
}
Expand Down Expand Up @@ -185,7 +185,7 @@ export default class PackageConverter {

const snippetsBySelector = {}
const destination = path.join(this.destinationPath, "snippets")
for (let child of fs.readdirSync(sourceSnippets)) {
for (const child of fs.readdirSync(sourceSnippets)) {
var left, selector
const snippet = (left = this.readFileSync(path.join(sourceSnippets, child))) != null ? left : {}
let { scope, name, content, tabTrigger } = snippet
Expand All @@ -194,11 +194,11 @@ export default class PackageConverter {
}

// Replace things like '${TM_C_POINTER: *}' with ' *'
content = content.replace(/\$\{TM_[A-Z_]+:([^}]+)}/g, "$1")
content = content.replace(/\${TM_[A-Z_]+:([^}]+)}/g, "$1")

// Replace things like '${1:${TM_FILENAME/(\\w+)*/(?1:$1:NSObject)/}}'
// with '$1'
content = content.replace(/\$\{(\d)+:\s*\$\{TM_[^}]+\s*\}\s*\}/g, "$$1")
content = content.replace(/\${(\d)+:\s*\${TM_[^}]+\s*}\s*}/g, "$$1")

// Unescape escaped dollar signs $
content = content.replace(/\\\$/g, "$")
Expand Down Expand Up @@ -241,7 +241,7 @@ export default class PackageConverter {

const preferencesBySelector = {}
const destination = path.join(this.destinationPath, "settings")
for (let child of fs.readdirSync(sourcePreferences)) {
for (const child of fs.readdirSync(sourcePreferences)) {
var left, properties
const { scope, settings } = (left = this.readFileSync(path.join(sourcePreferences, child))) != null ? left : {}
if (!scope || !settings) {
Expand All @@ -256,7 +256,7 @@ export default class PackageConverter {
e.message = `In file ${e.fileName} at ${JSON.stringify(scope)}: ${e.message}`
throw e
}
for (let key in properties) {
for (const key in properties) {
const value = properties[key]
if (preferencesBySelector[selector] == null) {
preferencesBySelector[selector] = {}
Expand Down Expand Up @@ -284,7 +284,7 @@ export default class PackageConverter {
}

const destination = path.join(this.destinationPath, "grammars")
for (let child of fs.readdirSync(sourceSyntaxes)) {
for (const child of fs.readdirSync(sourceSyntaxes)) {
const childPath = path.join(sourceSyntaxes, child)
if (fs.isFileSync(childPath)) {
this.convertFile(childPath, destination)
Expand Down
2 changes: 1 addition & 1 deletion src/star.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Run \`apm stars\` to see all your starred packages.\
getInstalledPackageNames() {
const installedPackages = []
const userPackagesDirectory = path.join(config.getAtomDirectory(), "packages")
for (let child of fs.list(userPackagesDirectory)) {
for (const child of fs.list(userPackagesDirectory)) {
var manifestPath
if (!fs.isDirectorySync(path.join(userPackagesDirectory, child))) {
continue
Expand Down
12 changes: 6 additions & 6 deletions src/text-mate-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class TextMateTheme {
settings = []
}

for (let setting of settings) {
for (const setting of settings) {
const { scope, name } = setting.settings
if (scope || name) {
continue
Expand Down Expand Up @@ -60,9 +60,9 @@ The theme being converted must contain a settings array with all of the followin

getStylesheet() {
const lines = ['@import "syntax-variables";', ""]
for (let { selector, properties } of this.getRulesets()) {
for (const { selector, properties } of this.getRulesets()) {
lines.push(`${selector} {`)
for (let name in properties) {
for (const name in properties) {
const value = properties[name]
lines.push(` ${name}: ${value};`)
}
Expand All @@ -81,7 +81,7 @@ The theme being converted must contain a settings array with all of the followin

buildSyntaxVariables(settings) {
this.syntaxVariables = SyntaxVariablesTemplate
for (let key in settings) {
for (const key in settings) {
const value = settings[key]
const replaceRegex = new RegExp(`\\{\\{${key}\\}\\}`, "g")
this.syntaxVariables = this.syntaxVariables.replace(replaceRegex, this.translateColor(value))
Expand Down Expand Up @@ -168,7 +168,7 @@ atom-text-editor.is-focused .line.cursor-line`,
buildScopeSelectorRulesets(scopeSelectorSettings) {
return (() => {
const result = []
for (let { name, scope, settings } of scopeSelectorSettings) {
for (const { name, scope, settings } of scopeSelectorSettings) {
if (!scope) {
continue
}
Expand Down Expand Up @@ -205,7 +205,7 @@ atom-text-editor.is-focused .line.cursor-line`,
}

if (foreground) {
properties["color"] = this.translateColor(foreground)
properties.color = this.translateColor(foreground)
}
if (background) {
properties["background-color"] = this.translateColor(background)
Expand Down
8 changes: 4 additions & 4 deletions src/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ available updates.\

getInstalledPackages(options) {
let packages = []
for (let name of fs.list(this.atomPackagesDirectory)) {
for (const name of fs.list(this.atomPackagesDirectory)) {
var pack
if ((pack = this.getIntalledPackage(name))) {
packages.push(pack)
Expand Down Expand Up @@ -162,7 +162,7 @@ available updates.\
git.addGitToEnv(process.env)
return this.spawn(command, args, { cwd: repoPath }, function (code, stderr = "", stdout = "") {
if (code !== 0) {
return callback(new Error("Exit code: " + code + " - " + stderr))
return callback(new Error(`Exit code: ${code} - ${stderr}`))
}
const repo = Git.open(repoPath)
const sha = repo.getReferenceTarget(repo.getUpstreamBranch("refs/heads/master"))
Expand Down Expand Up @@ -210,7 +210,7 @@ available updates.\
installUpdates(updates, callback) {
const installCommands = []
const { verbose } = this
for (let { pack, latestVersion } of updates) {
for (const { pack, latestVersion } of updates) {
;((pack, latestVersion) =>
installCommands.push(function (callback) {
let commandArgs
Expand Down Expand Up @@ -268,7 +268,7 @@ available updates.\
})
console.log(JSON.stringify(packagesWithLatestVersionOrSha))
} else {
console.log("Package Updates Available".cyan + ` (${updates.length})`)
console.log(`${"Package Updates Available".cyan} (${updates.length})`)
tree(updates, function ({ pack, latestVersion, sha }) {
let { name, apmInstallSource, version } = pack
name = name.yellow
Expand Down
2 changes: 1 addition & 1 deletion src/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ View information about a package/theme in the atom.io registry.\

let latestVersion = null
const object = pack.versions != null ? pack.versions : {}
for (let version in object) {
for (const version in object) {
const metadata = object[version]
if (!semver.valid(version)) {
continue
Expand Down

0 comments on commit b35898a

Please sign in to comment.