Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 6e02446

Browse files
committed
package: run lint:fix
Most of the changes we're made by `standard` automatically
1 parent 67048df commit 6e02446

14 files changed

+1415
-1407
lines changed

Diff for: lib/helpers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import path from 'path'
44

5-
export function getPackageRoot() {
6-
const {resourcePath} = atom.getLoadSettings()
5+
export function getPackageRoot () {
6+
const { resourcePath } = atom.getLoadSettings()
77
const currentFileWasRequiredFromSnapshot = !path.isAbsolute(__dirname)
88
if (currentFileWasRequiredFromSnapshot) {
99
return path.join(resourcePath, 'node_modules', 'snippets')

Diff for: lib/insertion.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,21 @@ class Insertion {
6262

6363
makeReplacer (replace) {
6464
return function replacer (...match) {
65-
let flags = {
65+
const flags = {
6666
uppercaseAll: false,
6767
lowercaseAll: false,
6868
uppercaseNext: false,
6969
lowercaseNext: false
7070
}
7171
replace = [...replace]
72-
let result = []
72+
const result = []
7373
replace.forEach(token => {
7474
if (typeof token === 'string') {
7575
result.push(transformText(token, flags))
7676
} else if (token.escape) {
7777
ESCAPES[token.escape](flags, result)
7878
} else if (token.backreference) {
79-
let transformed = transformText(match[token.backreference], flags)
79+
const transformed = transformText(match[token.backreference], flags)
8080
result.push(transformed)
8181
}
8282
})
@@ -85,7 +85,7 @@ class Insertion {
8585
}
8686

8787
transform (input) {
88-
let { substitution } = this
88+
const { substitution } = this
8989
if (!substitution) { return input }
9090
return input.replace(substitution.find, this.replacer)
9191
}

Diff for: lib/snippet-body-parser.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ let parser
22
try {
33
parser = require('./snippet-body')
44
} catch (error) {
5-
const {allowUnsafeEval} = require('loophole')
5+
const { allowUnsafeEval } = require('loophole')
66
const fs = require('fs-plus')
77
const PEG = require('pegjs')
88

99
const grammarSrc = fs.readFileSync(require.resolve('./snippet-body.pegjs'), 'utf8')
1010
parser = null
11-
allowUnsafeEval(() => parser = PEG.buildParser(grammarSrc))
11+
allowUnsafeEval(() => { parser = PEG.buildParser(grammarSrc) })
1212
}
1313

1414
module.exports = parser

Diff for: lib/snippet-expansion.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
const {CompositeDisposable, Range, Point} = require('atom')
1+
const { CompositeDisposable, Range, Point } = require('atom')
22

33
module.exports = class SnippetExpansion {
4-
constructor(snippet, editor, cursor, snippets) {
4+
constructor (snippet, editor, cursor, snippets) {
55
this.settingTabStop = false
66
this.isIgnoringBufferChanges = false
77
this.onUndoOrRedo = this.onUndoOrRedo.bind(this)
88
this.snippet = snippet
99
this.editor = editor
1010
this.cursor = cursor
1111
this.snippets = snippets
12-
this.subscriptions = new CompositeDisposable
12+
this.subscriptions = new CompositeDisposable()
1313
this.tabStopMarkers = []
1414
this.selections = [this.cursor.selection]
1515

1616
const startPosition = this.cursor.selection.getBufferRange().start
17-
let {body, tabStopList} = this.snippet
17+
let { body, tabStopList } = this.snippet
1818
let tabStops = tabStopList.toArray()
1919

20-
let indent = this.editor.lineTextForBufferRow(startPosition.row).match(/^\s*/)[0]
20+
const indent = this.editor.lineTextForBufferRow(startPosition.row).match(/^\s*/)[0]
2121
if (this.snippet.lineCount > 1 && indent) {
2222
// Add proper leading indentation to the snippet
2323
body = body.replace(/\n/g, `\n${indent}`)
@@ -28,7 +28,7 @@ module.exports = class SnippetExpansion {
2828
this.editor.transact(() => {
2929
this.ignoringBufferChanges(() => {
3030
this.editor.transact(() => {
31-
const newRange = this.cursor.selection.insertText(body, {autoIndent: false})
31+
const newRange = this.cursor.selection.insertText(body, { autoIndent: false })
3232
if (this.snippet.tabStopList.length > 0) {
3333
this.subscriptions.add(this.cursor.onDidChangePosition(event => this.cursorMoved(event)))
3434
this.subscriptions.add(this.cursor.onDidDestroy(() => this.cursorDestroyed()))
@@ -47,7 +47,7 @@ module.exports = class SnippetExpansion {
4747
this.isUndoingOrRedoing = true
4848
}
4949

50-
cursorMoved ({oldBufferPosition, newBufferPosition, textChanged}) {
50+
cursorMoved ({ oldBufferPosition, newBufferPosition, textChanged }) {
5151
if (this.settingTabStop || textChanged) { return }
5252
const itemWithCursor = this.tabStopMarkers[this.tabStopIndex].find(item => item.marker.getBufferRange().containsPoint(newBufferPosition))
5353

@@ -95,7 +95,7 @@ module.exports = class SnippetExpansion {
9595

9696
this.ignoringBufferChanges(() => {
9797
for (const item of items) {
98-
const {marker, insertion} = item
98+
const { marker, insertion } = item
9999
var range = marker.getBufferRange()
100100

101101
// Don't transform mirrored tab stops. They have their own cursors, so
@@ -115,14 +115,14 @@ module.exports = class SnippetExpansion {
115115

116116
placeTabStopMarkers (startPosition, tabStops) {
117117
for (const tabStop of tabStops) {
118-
const {insertions} = tabStop
118+
const { insertions } = tabStop
119119
const markers = []
120120

121121
if (!tabStop.isValid()) { continue }
122122

123123
for (const insertion of insertions) {
124-
const {range} = insertion
125-
const {start, end} = range
124+
const { range } = insertion
125+
const { start, end } = range
126126
const marker = this.getMarkerLayer(this.editor).markBufferRange([
127127
startPosition.traverse(start),
128128
startPosition.traverse(end)
@@ -178,7 +178,7 @@ module.exports = class SnippetExpansion {
178178
const ranges = []
179179
this.hasTransforms = false
180180
for (const item of items) {
181-
const {marker, insertion} = item
181+
const { marker, insertion } = item
182182
if (marker.isDestroyed()) { continue }
183183
if (!marker.isValid()) { continue }
184184
if (insertion.isTransformation()) {
@@ -217,7 +217,7 @@ module.exports = class SnippetExpansion {
217217
if (this.tabStopMarkers.length === 0) { return }
218218
const items = this.tabStopMarkers[this.tabStopMarkers.length - 1]
219219
if (items.length === 0) { return }
220-
const {marker: lastMarker} = items[items.length - 1]
220+
const { marker: lastMarker } = items[items.length - 1]
221221
if (lastMarker.isDestroyed()) {
222222
return false
223223
} else {

Diff for: lib/snippet-history-provider.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function wrap (manager, callbacks) {
2-
let klass = new SnippetHistoryProvider(manager)
2+
const klass = new SnippetHistoryProvider(manager)
33
return new Proxy(manager, {
44
get (target, name) {
55
if (name in callbacks) {

Diff for: lib/snippet.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const {Range} = require('atom')
1+
const { Range } = require('atom')
22
const TabStopList = require('./tab-stop-list')
33

44
module.exports = class Snippet {
5-
constructor({name, prefix, bodyText, description, descriptionMoreURL, rightLabelHTML, leftLabel, leftLabelHTML, bodyTree}) {
5+
constructor ({ name, prefix, bodyText, description, descriptionMoreURL, rightLabelHTML, leftLabel, leftLabelHTML, bodyTree }) {
66
this.name = name
77
this.prefix = prefix
88
this.bodyText = bodyText
@@ -21,11 +21,11 @@ module.exports = class Snippet {
2121
let column = 0
2222

2323
// recursive helper function; mutates vars above
24-
let extractTabStops = bodyTree => {
24+
const extractTabStops = bodyTree => {
2525
for (const segment of bodyTree) {
2626
if (segment.index != null) {
27-
let {index, content, substitution} = segment
28-
if (index === 0) { index = Infinity; }
27+
let { index, content, substitution } = segment
28+
if (index === 0) { index = Infinity }
2929
const start = [row, column]
3030
extractTabStops(content)
3131
const range = new Range(start, [row, column])

Diff for: lib/snippets-available.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ export default class SnippetsAvailable {
7070

7171
populate () {
7272
const snippets = Object.values(this.snippets.getSnippets(this.editor))
73-
for (let snippet of snippets) {
73+
for (const snippet of snippets) {
7474
snippet.searchText = _.compact([snippet.prefix, snippet.name]).join(' ')
7575
}
76-
return this.selectListView.update({items: snippets})
76+
return this.selectListView.update({ items: snippets })
7777
}
7878

7979
attach () {
8080
this.previouslyFocusedElement = document.activeElement
81-
this.panel = atom.workspace.addModalPanel({item: this})
81+
this.panel = atom.workspace.addModalPanel({ item: this })
8282
this.selectListView.focus()
8383
}
8484
}

0 commit comments

Comments
 (0)