You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2015/10/19 11:06:51 UTC
[4/6] fauxton commit: updated refs/heads/master to 42b9fa4
unify jshint and jscs
use the modern eslint to replace jshint and jscs
- faster checks as everything is done in one run
- style testing for jsx files
PR: #560
PR-URL: https://github.com/apache/couchdb-fauxton/pull/560
Reviewed-By: Benjamin Keen <be...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/1d8569f1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/1d8569f1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/1d8569f1
Branch: refs/heads/master
Commit: 1d8569f126e1f1818b3d6bc868f7ff53fe771111
Parents: 3e86afa
Author: Robert Kowalski <ro...@apache.org>
Authored: Fri Oct 16 15:34:06 2015 +0200
Committer: Robert Kowalski <ro...@apache.org>
Committed: Mon Oct 19 11:06:14 2015 +0200
----------------------------------------------------------------------
.eslintignore | 11 ++++++++
.eslintrc | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
.jscsrc | 42 -------------------------------
.jshintrc | 37 ---------------------------
Gruntfile.js | 24 ++++++------------
package.json | 11 ++++----
6 files changed, 98 insertions(+), 101 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1d8569f1/.eslintignore
----------------------------------------------------------------------
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..1680c40
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,11 @@
+# node_modules ignored by default
+
+dist/
+test/
+assets/
+
+app/**/*.react.js
+app/addons/.module-cache
+app/addons/**/assets/*
+app/addons/**/dependencies/*
+app/load_addons.js
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1d8569f1/.eslintrc
----------------------------------------------------------------------
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..04e9936
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,74 @@
+{
+ "root": true,
+
+ "ecmaFeatures": {
+ "jsx": true
+ },
+
+ "rules-todo": {
+ "space-in-parens": 2,
+ "space-unary-ops": 2,
+ "camelcase": 2
+ },
+
+ "rules": {
+ "semi": [2, "always"],
+ "no-undef": 2,
+ "space-after-keywords": 2,
+ "space-before-keywords": 2,
+ "space-before-function-paren": 2,
+ "space-infix-ops": 2,
+ "space-return-throw-case": 2,
+ "space-before-blocks": 2,
+ "array-bracket-spacing": [2, "never"],
+ "brace-style": [2, "1tbs", { "allowSingleLine": true }],
+ "comma-spacing": [2, {"before": false, "after": true}],
+ "computed-property-spacing": [2, "never"],
+ "eol-last": 2,
+ "no-mixed-spaces-and-tabs": [2, "smart-tabs"],
+ "no-trailing-spaces": 2,
+ "semi-spacing": [2, {"before": false, "after": true}],
+ "no-empty": 2
+ },
+
+ "env": {
+ "browser": true,
+ "node": true,
+ "jquery": true,
+ "amd": true,
+ "mocha": true,
+ "phantomjs": true,
+ },
+
+ "globals": {
+ "document": true,
+ "window": true,
+ "location": true,
+ "alert": true,
+ "console": true,
+ "clearInterval": true,
+ "setInterval": true,
+ "setTimeout": true,
+ "prompt": true,
+ "confirm": true,
+
+ "jQuery": true,
+ "Backbone": true,
+ "$": true,
+ "_": true,
+ "require": true,
+ "module": true,
+ "sinon": true,
+ "it": true,
+ "describe": true,
+ "beforeEach": true,
+ "afterEach": true,
+ "before": true,
+ "after": true,
+ "define": true,
+
+ "Spinner": true,
+ "prettyPrint": true
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1d8569f1/.jscsrc
----------------------------------------------------------------------
diff --git a/.jscsrc b/.jscsrc
deleted file mode 100644
index 64d1693..0000000
--- a/.jscsrc
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "disallowEmptyBlocks": true,
- "disallowKeywordsOnNewLine": ["else"],
- "disallowTrailingWhitespace": true,
- "validateIndentation": 2,
- "fileExtensions": [".js", ".jsx"],
- "excludeFiles": [
- "app/**/*.react.js",
- "app/addons/.module-cache",
- "app/addons/**/assets/*",
- "app/addons/**/dependencies/*",
- "app/load_addons.js"
- ],
- "disallowMixedSpacesAndTabs": true,
- "requireSpaceBeforeBinaryOperators": [
- "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
- "&=", "|=", "^=", "+=",
-
- "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
- "|", "^", "&&", "||", "===", "==", ">=",
- "<=", "<", ">", "!=", "!=="
- ],
- "requireSpaceAfterBinaryOperators": true,
- "requireSpacesInConditionalExpression": true,
- "requireSpaceBeforeBlockStatements": true,
- "requireLineFeedAtFileEnd": true,
- "requireSpacesInFunctionExpression": {
- "beforeOpeningCurlyBrace": true
- },
- "requireSpaceAfterKeywords": [
- "if",
- "else",
- "for",
- "while",
- "do",
- "switch",
- "return",
- "try",
- "catch",
- "function"
- ]
-}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1d8569f1/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index f999166..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "scripturl": true,
- "evil": true,
- "expr": true,
- "undef": true,
- "globals": {
- "document": true,
- "window": true,
- "location": true,
- "alert": true,
- "console": true,
- "clearInterval": true,
- "setInterval": true,
- "setTimeout": true,
- "prompt": true,
- "confirm": true,
-
- "jQuery": true,
- "Backbone": true,
- "$": true,
- "_": true,
- "require": true,
- "module": true,
- "sinon": true,
- "it": true,
- "describe": true,
- "beforeEach": true,
- "afterEach": true,
- "before": true,
- "after": true,
- "define": true,
-
- "Spinner": true,
- "prettyPrint": true
-
- }
-}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1d8569f1/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index b4cf7aa..07ec1f5 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -165,13 +165,6 @@ module.exports = function (grunt) {
}
},
- jshint: {
- all: ['app/**/*.js', 'Gruntfile.js', "!app/**/assets/js/*.js", "!app/**/dependencies/*", "!app/**/*.jsx"],
- options: {
- jshintrc: '.jshintrc'
- }
- },
-
// The jst task compiles all application templates into JavaScript
// functions with the underscore.js template function from 1.2.4. You can
// change the namespace and the template options, by reading this:
@@ -501,9 +494,9 @@ module.exports = function (grunt) {
// jsx command above doesn't allow targeting a specific file, just a folder. So any JSX file in the changed file
// folder or subfolder are copied over, causing every one of the files to be jshinted. Still far faster than before
if (targetFilepath.indexOf('test.config.js') === -1) {
- grunt.config(['jshint', 'all'], targetFilepath);
- grunt.task.run(['jshint']);
- config.shell.stylecheckSingleFile.command = 'node ./node_modules/jsxcs/bin/jsxcs ' + targetFilepath;
+
+ config.shell.stylecheckSingleFile.command = 'node ./node_modules/eslint/bin/eslint.js ' + targetFilepath;
+
grunt.task.run(['shell:stylecheckSingleFile']);
}
});
@@ -521,7 +514,6 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
- grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-jst');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-concat');
@@ -540,8 +532,8 @@ module.exports = function (grunt) {
* Transformation tasks
*/
// clean out previous build artifacts and lint
- grunt.registerTask('lint', ['clean', 'jshint']);
- grunt.registerTask('test', ['checkTestExists', 'clean:release', 'dependencies', 'jsx', 'jshint', 'shell:stylecheck', 'gen_initialize:development', 'test_inline']);
+ grunt.registerTask('lint', ['clean', 'shell:stylecheck']);
+ grunt.registerTask('test', ['checkTestExists', 'clean:release', 'dependencies', 'jsx', 'shell:stylecheck', 'gen_initialize:development', 'test_inline']);
// lighter weight test task for use inside dev/watch
grunt.registerTask('test_inline', ['mochaSetup', 'jst', 'concat:test_config_js', 'shell:phantomjs']);
@@ -564,14 +556,14 @@ module.exports = function (grunt) {
grunt.registerTask('debug', ['lint', 'dependencies', "gen_initialize:development", 'jsx', 'concat:requirejs', 'less',
'concat:index_css', 'template:development', 'copy:debug']);
- grunt.registerTask('debugDev', ['clean', 'dependencies', "gen_initialize:development", 'jsx', 'jshint', 'shell:stylecheck',
+ grunt.registerTask('debugDev', ['clean', 'dependencies', "gen_initialize:development", 'jsx', 'shell:stylecheck',
'less', 'concat:index_css', 'template:development', 'copy:debug']);
- grunt.registerTask('watchRun', ['clean:watch', 'dependencies', 'jshint', 'shell:stylecheck']);
+ grunt.registerTask('watchRun', ['clean:watch', 'dependencies', 'shell:stylecheck']);
// build a release
grunt.registerTask('release_commons_prefix', ['clean', 'dependencies']);
- grunt.registerTask('release_commons_suffix', ['jshint', 'shell:build-jsx', 'build', 'copy:dist', 'copy:ace', 'copy:addonDependencies']);
+ grunt.registerTask('release_commons_suffix', ['shell:stylecheck', 'shell:build-jsx', 'build', 'copy:dist', 'copy:ace', 'copy:addonDependencies']);
grunt.registerTask('release', ['release_commons_prefix', 'gen_initialize:release', 'release_commons_suffix']);
grunt.registerTask('couchapp_release', ['release_commons_prefix', 'gen_initialize:couchapp', 'release_commons_suffix']);
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1d8569f1/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index f7ec93e..d52f3e0 100644
--- a/package.json
+++ b/package.json
@@ -10,14 +10,15 @@
"fauxton": "./bin/fauxton"
},
"devDependencies": {
- "nightwatch": "^0.6.0",
+ "grunt-contrib-watch": "~0.6.1",
"mocha-phantomjs": "~3.2.x",
- "phantomjs": "~1.9.1",
- "grunt-contrib-watch": "~0.6.1"
+ "nightwatch": "^0.6.0",
+ "phantomjs": "~1.9.1"
},
"dependencies": {
"async": "~0.2.6",
"couchapp": "~0.11.0",
+ "eslint": "^1.6.0",
"grunt": "~0.4.1",
"grunt-chmod": "^1.0.3",
"grunt-cli": "~0.1.6",
@@ -25,7 +26,6 @@
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "~0.5.0",
- "grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-jst": "~0.5.0",
"grunt-contrib-less": "~0.11.0",
"grunt-contrib-requirejs": "~0.4.1",
@@ -36,7 +36,6 @@
"grunt-md5": "^0.1.11",
"grunt-shell": "^1.1.1",
"http-proxy": "~1.10.1",
- "jsxcs": "~0.2.1",
"lodash": "^3.6.0",
"nano": "~5.12.0",
"optimist": "^0.6.1",
@@ -48,7 +47,7 @@
"urls": "~0.0.3"
},
"scripts": {
- "stylecheck": "jsxcs app && jsxcs test/nightwatch_tests && jsxcs tasks && jsxcs Gruntfile.js",
+ "stylecheck": "eslint .",
"test": "grunt test",
"couchdebug": "grunt couchdebug",
"couchdb": "grunt couchdb",