From 3a25fa6c40e3a7c1dd3b079d0e30ec9c58388145 Mon Sep 17 00:00:00 2001 From: Dmytro Sych Date: Sun, 9 Apr 2017 17:39:34 -0400 Subject: [PATCH 1/9] prettier plugin for eslint --- .eslintrc.json | 11 +++- Gruntfile.js | 1 + package.json | 145 +++++++++++++++++++++++++------------------------ 3 files changed, 84 insertions(+), 73 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2a896ea5262..2c7ec741763 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,16 @@ { + "extends": [ + "prettier" + ], + "plugins": [ + "prettier" + ], "rules": { "no-bitwise": 0, "curly": 2, "eqeqeq": 2, "guard-for-in": 0, - "wrap-iife": [2, "outside"], + "wrap-iife": [2, "inside"], "no-use-before-define": 0, "new-cap": [0, { "capIsNewExceptions": [ @@ -47,7 +53,8 @@ "no-trailing-spaces": 0, "eol-last": 0, - "max-len": [1, 120] + "max-len": [1, 120], + "prettier/prettier": "error" }, "globals": { "brackets": false, diff --git a/Gruntfile.js b/Gruntfile.js index 9e7a40c6473..d443bc67ea0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -369,6 +369,7 @@ module.exports = function (grunt) { src: '<%= meta.src %>', test: '<%= meta.test %>', options: { + fix: true, quiet: true } }, diff --git a/package.json b/package.json index 2e5adb0e9ab..aff9bb2ed62 100644 --- a/package.json +++ b/package.json @@ -1,73 +1,76 @@ { - "name": "bramble", - "version": "1.9.0-0", - "apiVersion": "1.9.0", - "homepage": "https://mozillathimblelivepreview.net/bramble/staging/dist/hosted.html", - "issues": { - "url": "http://github.com/mozilla/brackets/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/mozilla/brackets.git", - "branch": "", - "SHA": "" - }, - "dependencies": { - "anymatch": "1.3.0", - "aws-sdk": "^2.19.0", - "chokidar": "1.6.0", - "glob": "7.0.6", - "grunt": "0.4.5", - "grunt-cleanempty": "1.0.3", - "grunt-cli": "0.1.9", - "grunt-contrib-clean": "0.4.1", - "grunt-contrib-compress": "^1.4.1", - "grunt-contrib-concat": "0.3.0", - "grunt-contrib-copy": "0.4.1", - "grunt-contrib-cssmin": "0.6.0", - "grunt-contrib-htmlmin": "0.1.3", - "grunt-contrib-jasmine": "0.4.2", - "grunt-contrib-less": "1.4.0", - "grunt-contrib-requirejs": "0.4.1", - "grunt-contrib-uglify": "^2.3.0", - "grunt-contrib-watch": "0.4.3", - "grunt-eslint": "18.1.0", - "grunt-exec": "^1.0.1", - "grunt-jasmine-node": "0.1.0", - "grunt-lib-phantomjs": "0.3.0", - "grunt-targethtml": "0.2.6", - "grunt-template-jasmine-requirejs": "0.1.0", - "grunt-usemin": "0.1.11", - "jasmine-node": "1.11.0", - "less-plugin-autoprefix": "^1.5.1", - "load-grunt-tasks": "3.5.0", - "lodash": "4.15.0", - "phantomjs": "1.9.18", - "q": "1.4.1", - "semver": "^4.1.0", - "xmldoc": "^0.1.2" - }, - "devDependencies": { - "bluebird": "^3.4.7", - "gunzip-maybe": "^1.3.1", - "http-server": "^0.9.0", - "mkdirp": "0.5.1", - "nunjucks": "^2.4.3", - "properties-parser": "0.3.1", - "request": "^2.69.0", - "requirejs": "^2.3.3", - "sw-precache": "^5.0.0", - "tar-fs": "^1.15.1" - }, - "scripts": { - "localize": "node scripts/properties2js", - "postinstall": "grunt install", - "build": "grunt build-browser", - "preproduction": "grunt build-browser-compressed && grunt unlocalize", - "production": "npm start", - "unlocalize": "grunt unlocalize", - "test": "grunt test && grunt build-browser-compressed", - "start": "http-server -p 8000 --cors" - }, - "license": "MIT" + "name": "bramble", + "version": "1.9.0-0", + "apiVersion": "1.9.0", + "homepage": "https://mozillathimblelivepreview.net/bramble/staging/dist/hosted.html", + "issues": { + "url": "http://github.com/mozilla/brackets/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/mozilla/brackets.git", + "branch": "", + "SHA": "" + }, + "dependencies": { + "anymatch": "1.3.0", + "aws-sdk": "^2.19.0", + "chokidar": "1.6.0", + "glob": "7.0.6", + "grunt": "0.4.5", + "grunt-cleanempty": "1.0.3", + "grunt-cli": "0.1.9", + "grunt-contrib-clean": "0.4.1", + "grunt-contrib-compress": "^1.4.1", + "grunt-contrib-concat": "0.3.0", + "grunt-contrib-copy": "0.4.1", + "grunt-contrib-cssmin": "0.6.0", + "grunt-contrib-htmlmin": "0.1.3", + "grunt-contrib-jasmine": "0.4.2", + "grunt-contrib-less": "1.4.0", + "grunt-contrib-requirejs": "0.4.1", + "grunt-contrib-uglify": "^2.3.0", + "grunt-contrib-watch": "0.4.3", + "grunt-eslint": "18.1.0", + "grunt-exec": "^1.0.1", + "grunt-jasmine-node": "0.1.0", + "grunt-lib-phantomjs": "0.3.0", + "grunt-targethtml": "0.2.6", + "grunt-template-jasmine-requirejs": "0.1.0", + "grunt-usemin": "0.1.11", + "jasmine-node": "1.11.0", + "less-plugin-autoprefix": "^1.5.1", + "load-grunt-tasks": "3.5.0", + "lodash": "4.15.0", + "phantomjs": "1.9.18", + "q": "1.4.1", + "semver": "^4.1.0", + "xmldoc": "^0.1.2" + }, + "devDependencies": { + "bluebird": "^3.4.7", + "eslint-config-prettier": "^1.6.0", + "eslint-plugin-prettier": "^2.0.1", + "gunzip-maybe": "^1.3.1", + "http-server": "^0.9.0", + "mkdirp": "0.5.1", + "nunjucks": "^2.4.3", + "prettier": "^0.22.0", + "properties-parser": "0.3.1", + "request": "^2.69.0", + "requirejs": "^2.3.3", + "sw-precache": "^5.0.0", + "tar-fs": "^1.15.1" + }, + "scripts": { + "localize": "node scripts/properties2js", + "postinstall": "grunt install", + "build": "grunt build-browser", + "preproduction": "grunt build-browser-compressed && grunt unlocalize", + "production": "npm start", + "unlocalize": "grunt unlocalize", + "test": "grunt test && grunt build-browser-compressed", + "start": "http-server -p 8000 --cors" + }, + "license": "MIT" } From bb27ae30ca061448512e5f79def12d650c84156c Mon Sep 17 00:00:00 2001 From: Dmytro Sych Date: Mon, 10 Apr 2017 16:41:44 -0400 Subject: [PATCH 2/9] updated dependency for grunt-eslint --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aff9bb2ed62..47501016c9e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "grunt-contrib-requirejs": "0.4.1", "grunt-contrib-uglify": "^2.3.0", "grunt-contrib-watch": "0.4.3", - "grunt-eslint": "18.1.0", + "grunt-eslint": "19.0.0", "grunt-exec": "^1.0.1", "grunt-jasmine-node": "0.1.0", "grunt-lib-phantomjs": "0.3.0", From b98b331408f7b1cffe3dc3f1decefcd5f74f54f8 Mon Sep 17 00:00:00 2001 From: Dmytro Sych Date: Thu, 13 Apr 2017 23:57:26 -0400 Subject: [PATCH 3/9] before githooks --- .eslintrc.json | 7 ++++++- Gruntfile.js | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2c7ec741763..83e486c3f0a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -54,7 +54,12 @@ "no-trailing-spaces": 0, "eol-last": 0, "max-len": [1, 120], - "prettier/prettier": "error" + "prettier/prettier": [ + "error", + { + "tabWidth": 4 + } + ] }, "globals": { "brackets": false, diff --git a/Gruntfile.js b/Gruntfile.js index d443bc67ea0..ceecb588600 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -271,6 +271,7 @@ module.exports = function (grunt) { '!src/thirdparty/**', '!src/widgets/bootstrap-*.js', '!src/extensions/default/brackets-show-whitespace/**', + '!src/extensions/default/brackets-paste-and-indent/**', '!src/extensions/**/unittest-files/**/*.js', '!src/extensions/**/thirdparty/**/*.js', '!src/extensions/dev/**', @@ -368,8 +369,14 @@ module.exports = function (grunt) { grunt: '<%= meta.grunt %>', src: '<%= meta.src %>', test: '<%= meta.test %>', + 'src-fix': { + src: '<%= meta.src %>', + options: { + fix: true, + quiet: true + } + }, options: { - fix: true, quiet: true } }, @@ -405,7 +412,15 @@ module.exports = function (grunt) { dist: { rootDir: 'dist' } - } + }, + + // githooks: { + // all: { + // startMarker: 'Starting prettier auto-format task', + // 'pre commit': 'eslint:src-fix', + // endMarker: 'Prettier auto-formatting finished', + // } + // } }; // Dynamically add requirejs and copy configs for all extensions From 09205b227b73a02b04054d6b8b9c58d04ee72b2c Mon Sep 17 00:00:00 2001 From: Dmytro Sych Date: Thu, 13 Apr 2017 23:57:49 -0400 Subject: [PATCH 4/9] test --- Gruntfile.js | 14 +++++++------- package.json | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ceecb588600..8da5544fac6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -414,13 +414,13 @@ module.exports = function (grunt) { } }, - // githooks: { - // all: { - // startMarker: 'Starting prettier auto-format task', - // 'pre commit': 'eslint:src-fix', - // endMarker: 'Prettier auto-formatting finished', - // } - // } + githooks: { + all: { + startMarker: 'Starting prettier auto-format task', + 'pre commit': 'eslint:src-fix', + endMarker: 'Prettier auto-formatting finished', + } + } }; // Dynamically add requirejs and copy configs for all extensions diff --git a/package.json b/package.json index 47501016c9e..472bc0227ac 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "bluebird": "^3.4.7", "eslint-config-prettier": "^1.6.0", "eslint-plugin-prettier": "^2.0.1", + "grunt-githooks": "^0.6.0", "gunzip-maybe": "^1.3.1", "http-server": "^0.9.0", "mkdirp": "0.5.1", From 16dd133131e76c26a2496eb5866e789999fd9a80 Mon Sep 17 00:00:00 2001 From: Dmytro Sych Date: Fri, 14 Apr 2017 00:05:21 -0400 Subject: [PATCH 5/9] test --- Gruntfile.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8da5544fac6..9653c30b76c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -413,7 +413,6 @@ module.exports = function (grunt) { rootDir: 'dist' } }, - githooks: { all: { startMarker: 'Starting prettier auto-format task', From 6c4c2b9123723be06a56aa7fef77dc955af5af1e Mon Sep 17 00:00:00 2001 From: Dmytro Sych Date: Fri, 14 Apr 2017 00:12:51 -0400 Subject: [PATCH 6/9] test1 --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 9653c30b76c..933209ea135 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -416,7 +416,7 @@ module.exports = function (grunt) { githooks: { all: { startMarker: 'Starting prettier auto-format task', - 'pre commit': 'eslint:src-fix', + 'pre-commit': 'eslint:src-fix', endMarker: 'Prettier auto-formatting finished', } } From 6f53505596c4dd981900c041e985d3865f757d58 Mon Sep 17 00:00:00 2001 From: Dmytro Sych Date: Fri, 14 Apr 2017 00:21:07 -0400 Subject: [PATCH 7/9] configuring git hooks --- Gruntfile.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 933209ea135..6cc38850cf1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -405,7 +405,8 @@ module.exports = function (grunt) { exec: { localize: 'node scripts/properties2js', 'localize-dist': 'node scripts/properties2js dist', - 'clean-nls': 'rm -fr src/nls && git checkout -- src/nls' + 'clean-nls': 'rm -fr src/nls && git checkout -- src/nls', + 'add-src': 'git add "src/*"' }, swPrecache: { @@ -416,7 +417,7 @@ module.exports = function (grunt) { githooks: { all: { startMarker: 'Starting prettier auto-format task', - 'pre-commit': 'eslint:src-fix', + 'pre-commit': 'eslint:src-fix exec:add-src', endMarker: 'Prettier auto-formatting finished', } } @@ -535,7 +536,8 @@ module.exports = function (grunt) { 'npm-install', */ 'cleanempty', 'exec:clean-nls', - 'usemin' + 'usemin', + 'githooks' /* XXXBramble: we skip this, since we don't bother with its info, and copy it in copy:dist 'build-config' */ ]); From 39d637dc3e0757fb6fd5293bf504503da582598f Mon Sep 17 00:00:00 2001 From: Dmytro Date: Wed, 19 Apr 2017 17:46:22 -0400 Subject: [PATCH 8/9] Update package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 97ff104efbf..2cdf98605ce 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,4 @@ - +{ "name": "bramble", "version": "1.9.0-0", "apiVersion": "1.9.0", @@ -31,7 +31,7 @@ "grunt-contrib-requirejs": "0.4.1", "grunt-contrib-uglify": "^2.3.0", "grunt-contrib-watch": "0.4.3", - "grunt-eslint": "18.1.0", + "grunt-eslint": "19.0.0", "grunt-exec": "^1.0.1", "grunt-jasmine-node": "0.1.0", "grunt-lib-phantomjs": "0.3.0", From ed8f4ec9a10a0ffb7739fea029af86b2e5516b61 Mon Sep 17 00:00:00 2001 From: Dmytro Date: Wed, 19 Apr 2017 17:51:43 -0400 Subject: [PATCH 9/9] Adding grunt-githooks dependency --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 2cdf98605ce..ced679a508e 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "eslint-config-prettier": "^1.6.0", "eslint-plugin-prettier": "^2.0.1", "prettier": "^0.22.0", + "grunt-githooks": "^0.6.0", "gunzip-maybe": "^1.3.1", "http-server": "mozilla/http-server#gzip", "mkdirp": "0.5.1",