Skip to content
Snippets Groups Projects
Commit 6f0317cc authored by Jack Reed's avatar Jack Reed
Browse files

Adds in eslintrc for the Airbnb ES5 styleguide.

Per discussion here:
https://github.com/ProjectMirador/mirador/issues/1318

The Airbnb canonical style is maintained by AirBnb in .eslintrc. Adding
this will allow developers to use the style for their new changes in
their preferred editor.
parent 411d79ff
No related branches found
No related tags found
No related merge requests found
{
"extends": "airbnb-base/legacy",
"globals": {
"Mirador": true,
"jQuery": true
},
"rules": {
}
}
...@@ -87,7 +87,9 @@ Some resources are managed with bower, but this is being phased out. It is recom ...@@ -87,7 +87,9 @@ Some resources are managed with bower, but this is being phased out. It is recom
#### Tasks #### Tasks
### Testing and Coverage ### Testing and Coverage
### Version Control ### Version Control
### Editorconfig and jsHint ### JavaScript Style
Contributors use a variety of text editors according to circumstance and preference. This can introduce inconsistencies in the source text files, such as spaces being replaced with tabs, indentation spans being shortened, and whitespace being added or subtracted from the end of lines. Using your editor's [EditorConfig](http://editorconfig.org/) plugin resolves these inconsistencies while allowing each developer to use her own preferences while developing. Contributors use a variety of text editors according to circumstance and preference. This can introduce inconsistencies in the source text files, such as spaces being replaced with tabs, indentation spans being shortened, and whitespace being added or subtracted from the end of lines. Using your editor's [EditorConfig](http://editorconfig.org/) plugin resolves these inconsistencies while allowing each developer to use her own preferences while developing.
[JSHint](http://jshint.com) will notify you of inconsistencies in the style of the code. Mirador uses the AirBnB [styleguide](https://github.com/airbnb/javascript/tree/es5-deprecated/es5) for ES5. DEPRECATED [NON-FUNCTIONAL]. [JSHint](http://jshint.com) will notify you of inconsistencies in the style of the code. Mirador uses the AirBnB [styleguide](https://github.com/airbnb/javascript/tree/es5-deprecated/es5) for ES5.
[eslint](http://eslint.org/). Mirador uses the AirBnb Javascript styleguide for ES5 as codified by AirBnb in [eslint-config-airbnb-base](https://www.npmjs.com/package/eslint-config-airbnb-base#eslint-config-airbnb-baselegacy). Make sure any changes you make conform to this style. You can check this by running the `npm run lint`. Error checking for this is not turned on in the continuous integration build at the moment, but will be in the future.
...@@ -4,6 +4,7 @@ module.exports = function(grunt) { ...@@ -4,6 +4,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-compress'); grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks("gruntify-eslint");
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
...@@ -229,6 +230,13 @@ module.exports = function(grunt) { ...@@ -229,6 +230,13 @@ module.exports = function(grunt) {
} }
}, },
eslint: {
options: {
silent: true
},
src: sources
},
jshint: { jshint: {
options: { options: {
browser: true, browser: true,
...@@ -274,16 +282,19 @@ module.exports = function(grunt) { ...@@ -274,16 +282,19 @@ module.exports = function(grunt) {
grunt.file.copy(abspath, dest); grunt.file.copy(abspath, dest);
}); });
}); });
// ----------
// Lint task
grunt.registerTask('lint', ['jshint', 'eslint'])
// ---------- // ----------
// Build task. // Build task.
// Cleans out the build folder and builds the code and images into it, checking lint. // Cleans out the build folder and builds the code and images into it, checking lint.
grunt.registerTask('build', [ 'clean:build', 'git-describe', 'jshint', 'less', 'concat:css', 'uglify', 'cssmin', 'copy']); grunt.registerTask('build', [ 'clean:build', 'git-describe', 'lint', 'less', 'concat:css', 'uglify', 'cssmin', 'copy']);
// ---------- // ----------
// Dev Build task. // Dev Build task.
// Build, but skip the time-consuming and obscurantist minification and uglification. // Build, but skip the time-consuming and obscurantist minification and uglification.
grunt.registerTask('dev_build', [ 'clean:build', 'git-describe', 'jshint', 'less', 'concat', 'copy']); grunt.registerTask('dev_build', [ 'clean:build', 'git-describe', 'lint', 'less', 'concat', 'copy']);
// ---------- // ----------
// Package task. // Package task.
...@@ -308,6 +319,6 @@ module.exports = function(grunt) { ...@@ -308,6 +319,6 @@ module.exports = function(grunt) {
// ---------- // ----------
// Runs this on travis. // Runs this on travis.
grunt.registerTask('ci', [ grunt.registerTask('ci', [
'jshint' 'lint'
]); ]);
}; };
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"devDependencies": { "devDependencies": {
"eslint": "^3.17.1",
"eslint-config-airbnb-base": "^11.1.1",
"eslint-plugin-import": "^2.2.0",
"gitbook": "3.2.0", "gitbook": "3.2.0",
"gitbook-cli": "2.3.0", "gitbook-cli": "2.3.0",
"gitbook-plugin-search": "2.2.1", "gitbook-plugin-search": "2.2.1",
...@@ -27,6 +30,7 @@ ...@@ -27,6 +30,7 @@
"grunt-git-describe": "*", "grunt-git-describe": "*",
"grunt-githooks": "^0.3.1", "grunt-githooks": "^0.3.1",
"grunt-template-jasmine-istanbul": "^0.3.3", "grunt-template-jasmine-istanbul": "^0.3.3",
"gruntify-eslint": "^3.1.0",
"jasmine-core": "^2.1.3", "jasmine-core": "^2.1.3",
"jasmine-jquery": "^2.0.5", "jasmine-jquery": "^2.0.5",
"karma": "^1.5", "karma": "^1.5",
...@@ -46,7 +50,8 @@ ...@@ -46,7 +50,8 @@
"start": "./node_modules/.bin/grunt serve", "start": "./node_modules/.bin/grunt serve",
"test": "./node_modules/.bin/karma start ./karma.conf.js", "test": "./node_modules/.bin/karma start ./karma.conf.js",
"travis": "./node_modules/.bin/grunt ci --verbose --force & npm run test", "travis": "./node_modules/.bin/grunt ci --verbose --force & npm run test",
"update_demo": "./bin/update_demo.sh" "update_demo": "./bin/update_demo.sh",
"lint": "./node_modules/.bin/eslint js/src"
}, },
"dependencies": { "dependencies": {
"bootbox": "^4.4.0", "bootbox": "^4.4.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment