diff --git a/.eslintrc b/.eslintrc index e985dc685b..99cf75fce3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,87 +1,3 @@ { - "parser": "babel-eslint", - "extends": [ - "google", - "eslint:recommended", - "plugin:react/recommended" - ], - "rules": { - "key-spacing": [2, { - "beforeColon": false, - "afterColon": true, - "align": { - "beforeColon": false, - "afterColon": true, - "mode": "minimum", - "on": "value" - } - }], - "quotes": [0], // no opinion on ' vs " - "object-curly-spacing": [0], - "new-cap": [0], // allows function calls like Immutable.Map(...) - "max-len": [0, { - "code": 80, - "ignoreComments": true, - }], - "indent": [2, 2], // no tabs, indent is 2 spaces - "newline-after-var": [0], - "react/jsx-indent-props": [2, 2], // no tabs, indent is two spaces - "react/jsx-key": [2], // validate that key prop exists - "react/jsx-no-undef": [2], // disallow undeclared variables in JSX - "react/prop-types": [0], - "react/display-name" : [0], - "react/no-find-dom-node": [0], - "react/no-unescaped-entities": [0], - "no-unused-vars": [ 2, { - "vars": "local", - "argsIgnorePattern": "action" - }], - "comma-dangle": [0], - "no-unreachable": [2], - "semi": [2, "never"], - "eqeqeq": [2], - "no-var": [2], - "camelcase": [2, { - "properties": "never" - }], - "guard-for-in": [2], - "prefer-template": [2], - "space-infix-ops": [2], - "space-before-blocks": [2], - "space-in-parens": [2], - "flow-vars/define-flow-type": [2], - "flow-vars/use-flow-type": [2], - "flowtype/space-after-type-colon": [0], - "flowtype/space-before-type-colon": [2, "never"], - "flowtype/generic-spacing": [2, "never"], - "flowtype/no-dupe-keys": [2], - "flowtype/no-primitive-constructor-types": [2], - "flowtype/object-type-delimiter": [2, "comma"], - "mocha/no-exclusive-tests": [2], - "mocha/no-skipped-tests": [2], - "mocha/no-sibling-hooks": [2], - "mocha/no-global-tests": [2], - "mocha/handle-done-callback": [2], - "mocha/no-top-level-hooks": [2], - "mocha/no-identical-title": [2], - "mocha/no-nested-tests": [2], - }, - "env": { - "es6": true, - "browser": true, - "node": true, - "mocha": true - }, - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - }, - "plugins": [ - "babel", - "react", - "flowtype", - "flow-vars", - "mocha" - ] + "extends": "eslint-config-mitodl" } diff --git a/package.json b/package.json index c050a04f41..3812a1024c 100644 --- a/package.json +++ b/package.json @@ -46,11 +46,12 @@ "eslint": "4.2.0", "eslint-config-defaults": "9.0.0", "eslint-config-google": "^0.9.1", + "eslint-config-mitodl": "^0.0.3", "eslint-plugin-babel": "^4.1.1", "eslint-plugin-flow-vars": "^0.5.0", "eslint-plugin-flowtype": "^2.35.1", - "eslint-plugin-mocha": "^4.9.0", - "eslint-plugin-react": "^7.0.1", + "eslint-plugin-mocha": "4.11.0", + "eslint-plugin-react": "7.1.0", "express": "^4.15.3", "fetch-mock": "^5.11.0", "file-loader": "^0.11.1", diff --git a/static/js/actions/course_enrollments_test.js b/static/js/actions/course_enrollments_test.js index 1e6149e384..fce6ab6bda 100644 --- a/static/js/actions/course_enrollments_test.js +++ b/static/js/actions/course_enrollments_test.js @@ -22,8 +22,8 @@ describe("show and hide enroll pay later success alert", () => { }) it("should set and reset enroll pay later dialog", () => { - let waitPromise = Promise.resolve() - let waitStub = sandbox.stub(util, "wait").returns(waitPromise) + const waitPromise = Promise.resolve() + const waitStub = sandbox.stub(util, "wait").returns(waitPromise) return dispatchThen(showEnrollPayLaterSuccessMessage("foo/bar/baz"), [ SHOW_ENROLL_PAY_LATER_SUCCESS diff --git a/static/js/actions/profile_test.js b/static/js/actions/profile_test.js index 8a591cc610..85b9cacfa1 100644 --- a/static/js/actions/profile_test.js +++ b/static/js/actions/profile_test.js @@ -7,7 +7,7 @@ import { assert } from "chai" describe("generated profile action helpers", () => { it("should take a username and a keySet", () => { - let action = updateValidationVisibility("my user", ["a", "key", "set"]) + const action = updateValidationVisibility("my user", ["a", "key", "set"]) assert.deepEqual(action, { type: UPDATE_VALIDATION_VISIBILITY, payload: { diff --git a/static/js/actions/util_test.js b/static/js/actions/util_test.js index b2d7a7843b..0ca6db9642 100644 --- a/static/js/actions/util_test.js +++ b/static/js/actions/util_test.js @@ -5,15 +5,15 @@ import { withUsername } from "./util" describe("action creator utils", () => { describe("withUsername", () => { - let TYPE = "TYPE" + const TYPE = "TYPE" it("should return an action creator, given a type", () => { - let creator = withUsername(TYPE) + const creator = withUsername(TYPE) assert.isFunction(creator) }) it("should add a username and a payload", () => { - let creator = withUsername(TYPE) - let action = creator("username", { my: "payload" }) + const creator = withUsername(TYPE) + const action = creator("username", { my: "payload" }) assert.deepEqual(action, { type: TYPE, payload: { my: "payload" }, diff --git a/static/js/components/CouponNotificationDialog.js b/static/js/components/CouponNotificationDialog.js index 2efc775963..c590a318c4 100644 --- a/static/js/components/CouponNotificationDialog.js +++ b/static/js/components/CouponNotificationDialog.js @@ -48,7 +48,7 @@ const CouponNotificationDialog = ({ courseName = `course ID ${objectId}` } - let isDiscount = + const isDiscount = amountType === COUPON_AMOUNT_TYPE_FIXED_DISCOUNT || amountType === COUPON_AMOUNT_TYPE_PERCENT_DISCOUNT diff --git a/static/js/components/CourseEnrollmentDialog.js b/static/js/components/CourseEnrollmentDialog.js index 632602b384..12d1d18e0b 100644 --- a/static/js/components/CourseEnrollmentDialog.js +++ b/static/js/components/CourseEnrollmentDialog.js @@ -69,7 +69,7 @@ export default class CourseEnrollmentDialog extends React.Component { hasUserApplied, pendingFinancialAid } = this.props - let message, payButton, auditButton + let message, payButton if (pendingFinancialAid) { message = `Your Personalized Course Price is still pending approval, but you can sign up now to audit the course for FREE, and then pay later. (Payment is required @@ -114,7 +114,7 @@ export default class CourseEnrollmentDialog extends React.Component { ) } - auditButton = ( + const auditButton = (