From 8db19a1c6c666ebeecdc6dd1142e200c459e9ba1 Mon Sep 17 00:00:00 2001 From: Michael Scott Hertzberg Date: Sat, 15 Oct 2016 13:59:52 -0400 Subject: [PATCH] add eslint with basic plugins and configuration. fixes #1470 --- .eslintrc | 72 +++++++++++++++++++++++++--------------------------- .gitignore | 3 ++- package.json | 10 +++++++- 3 files changed, 45 insertions(+), 40 deletions(-) diff --git a/.eslintrc b/.eslintrc index ba58e8afb..34f1a0820 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,44 +1,40 @@ -/* Galaxy's Javascript linting configuration (Meteor) - * - * Documentation on rules can be found at: - * http://eslint.org/docs/rules/ <- Optionally append the rulename - * - * Ensure changes are kept in sync with the base linting configuration. -*/ - { - "extends": ".eslintrc-meteor", - "env": { - /* Allows global vars from the Meteor environment to pass and enables certain rules */ - "meteor": true + "extends": [ + "eslint:recommended" + ], + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" }, "rules": { - - /* ---------------- Rules relaxed for Meteor's sake --------------------- */ - - /* allows use of var (remove when we are ready to switch to ES6) */ - "no-var": 0, - - /* allows anonymous functions */ - "func-names": 0, - - /* allows var = function() delcarations */ - "func-style": 0, - - /* relaxes max-len to 100 chars per line */ - "max-len": [2, 100, 2], - - /* relaxes requirement to put all vars at the top of the scope */ - "vars-on-top": 0, - - /* relaxes dangling commas enforcement */ + "babel/generator-star-spacing": 0, + "babel/new-cap": 1, + "babel/array-bracket-spacing": 0, + "babel/object-curly-spacing": 0, + "babel/object-shorthand": 0, + "babel/arrow-parens": 0, + "babel/no-await-in-loop": 1, "comma-dangle": 0, - - /* allows certain non-constructor functions to start with a capital letter, */ - "new-cap": [2, { "capIsNewExceptions": [ - "Match", "Any", "Object", "ObjectIncluding", "OneOf", "Optional", "Where" - ]}], - - /* ---------------------------------------------------------------------- */ + "key-spacing": 0, + "no-extra-boolean-cast": 0, + "no-undef": 1, + "no-unused-vars": 1, + "no-console": 1 + }, + "env": { + "es6": true, + "node": true, + "browser": true, + "commonjs": true + }, + "plugins": [ + "babel", + ], + "modules": true, + "root": true, + "globals": { + "param": true, + "returns": true } } diff --git a/.gitignore b/.gitignore index 986b8bbb6..fd580bef7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.eslintcache npm-debug.log *.scssc .sass-cache/* @@ -44,4 +45,4 @@ node_modules bundle.tar.gz jsdoc-conf.json -jsdoc.json \ No newline at end of file +jsdoc.json diff --git a/package.json b/package.json index ce820e176..216306d39 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,9 @@ "engines": { "npm": "^3.0" }, + "scripts": { + "lint": "eslint --cache packages" + }, "dependencies": { "bcrypt": "^0.8.7", "bootstrap": "^4.0.0-alpha.2", @@ -42,7 +45,12 @@ }, "private": true, "devDependencies": { - "autoprefixer": "^6.3.6" + "autoprefixer": "^6.3.6", + "babel-eslint": "^7.0.0", + "eslint": "^3.8.0", + "eslint-config-meteor": "0.0.9", + "eslint-plugin-babel": "^3.3.0", + "eslint-plugin-meteor": "^4.0.1" }, "postcss": { "plugins": {