Skip to content

Commit

Permalink
Add .gitattributes; More ESLint checks
Browse files Browse the repository at this point in the history
  • Loading branch information
matatk committed Dec 5, 2016
1 parent 9cfd1a5 commit 3dc6ceb
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 12 deletions.
13 changes: 12 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,27 @@
"chrome": true
},
"rules": {
"strict": ["error", "global"],
"quotes": ["error", "single", { "avoidEscape": true }],
"indent": ["error", "tab", { "SwitchCase": 1 }],
"brace-style": "error",
"curly": ["error", "multi-line"],
"no-unexpected-multiline": "error",
"semi": ["error", "never"],
"no-unused-vars": "warn",
"no-unused-expressions": "error",
"no-use-before-define": ["error", { "functions": false }],
"no-bitwise": "error",
"wrap-iife": "error",
"new-cap": "error",
"no-undef": "error",
"no-caller": "error",
"block-scoped-var": "error",
"no-var": "error",
"prefer-const": "error",
"eqeqeq": "error",
"no-eq-null": "error",
"no-labels": "error",
"space-before-function-paren": ["error", "never"],
"space-before-blocks": "error",
"no-lone-blocks": "error",
Expand All @@ -30,6 +41,6 @@
"space-unary-ops": "error",
"spaced-comment": "error",
"func-call-spacing": "error",
"no-console": "warn"
"no-console": "off"
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Changes
- 2.0.5 - 5th of December 2016
* No user-facing changes.
* Fix error in packaging (the new build system was not actually compressing the ZIP file, which different parts of the submission process for Chrome and Firefox didn't like—oops!)
* Add more code robustosity checks with ESLint.
- 2.0.4 - 4th of December 2016
* Clean up the appearance of the popup.
* Increase 'momentary' highlight duration to two seconds, from one second.
Expand Down
10 changes: 5 additions & 5 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ function logStep(name) {
function checkBuildMode() {
const args = process.argv.slice(2)

if (args.length !== 1 || buildModes.indexOf(args[0]) == -1) {
if (args.length !== 1 || buildModes.indexOf(args[0]) === -1) {
error(`Invalid build mode requested: expected one of [${buildModes}] but received '${args}'`)
}

if (args[0] == 'all') {
if (args[0] === 'all') {
return validBrowsers
}

Expand Down Expand Up @@ -121,10 +121,10 @@ function copyBackgroundScript(browser) {


// Get PNG files from the cache (which will generate them if needed)
function getPngs(browser) {
function getPngs(cache, browser) {
logStep('Generating/copying in PNG files...')
browserPngSizes[browser].forEach((size) => {
const pngPath = pc.getPngPath(size)
const pngPath = cache.getPngPath(size)
const basename = path.basename(pngPath)
fse.copySync(pngPath, path.join(pathToBuild(browser), basename))
})
Expand Down Expand Up @@ -170,6 +170,6 @@ browsers.forEach((browser) => {
copyStaticFiles(browser)
mergeManifest(browser)
copyBackgroundScript(browser)
getPngs(browser)
getPngs(pc, browser)
makeZip(browser)
})
9 changes: 5 additions & 4 deletions scripts/lib/png-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ const chalk = require('chalk')
const svg2png = require('svg2png')

module.exports = function(cacheDir, svgPath) {
// Initialisation
const svgModified = fse.statSync(svgPath).mtime
fse.ensureDirSync(cacheDir)


// Return the full path to the desired PNG
function pngPath(size) {
return path.join(cacheDir, 'landmarks-' + size + '.png')
Expand Down Expand Up @@ -33,10 +38,6 @@ module.exports = function(cacheDir, svgPath) {
}


// Initialisation
const svgModified = fse.statSync(svgPath).mtime
fse.ensureDirSync(cacheDir)

// Public API implementation
return {
// Get the path for a PNG of a particular size.
Expand Down
2 changes: 1 addition & 1 deletion src/assemble/background.chrome.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/* eslint-disable strict */

//
// Install and Update
Expand Down
4 changes: 3 additions & 1 deletion src/assemble/background.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

//
// Keyboard Shortcut Handling
//
Expand Down Expand Up @@ -49,7 +51,7 @@ function checkBrowserActionState(tabId, url) {
}

function startsWith(string, pattern) {
return string.substring(0, pattern.length) == pattern
return string.substring(0, pattern.length) === pattern
}

// If the page uses 'single-page app' techniques to load in new components --
Expand Down
1 change: 1 addition & 0 deletions src/static/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
'use strict'

let g_gotLandmarks = false // Have we already found landmarks?
let g_selectedIndex = -1 // Currently selected landmark
Expand Down
2 changes: 2 additions & 0 deletions src/static/options.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const borderTypeId = 'border-type'

function saveOptions() {
Expand Down
2 changes: 2 additions & 0 deletions src/static/popup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

// Handle incoming landmarks message response
//
// If there are landmarks, then the response will be a list of objects that
Expand Down

0 comments on commit 3dc6ceb

Please sign in to comment.