diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..ec9a0aae --- /dev/null +++ b/.eslintignore @@ -0,0 +1,7 @@ +/core*/ +/docs/jsdoc-template/ +/docs/output/ + +build/ +node_modules/ +vendor/ diff --git a/.eslintrc b/.eslintrc.json similarity index 88% rename from .eslintrc rename to .eslintrc.json index b0cf604c..d257f28b 100644 --- a/.eslintrc +++ b/.eslintrc.json @@ -3,6 +3,7 @@ "extends": "eslint:recommended", "rules": { "comma-dangle": 0, + "no-empty": 0, "no-unused-vars": 1, "strict": [2, "global"] } diff --git a/docs/.eslintrc.json b/docs/.eslintrc.json new file mode 100644 index 00000000..5546e8df --- /dev/null +++ b/docs/.eslintrc.json @@ -0,0 +1,11 @@ +{ + "parserOptions": { + "ecmaVersion": 6, + "ecmaFeatures": { + "impliedStrict": true + } + }, + "rules": { + "no-unused-vars": 0 + } +} diff --git a/examples/ReactExample/.eslintrc b/examples/ReactExample/.eslintrc.json similarity index 82% rename from examples/ReactExample/.eslintrc rename to examples/ReactExample/.eslintrc.json index 2e863dc5..37f901d5 100644 --- a/examples/ReactExample/.eslintrc +++ b/examples/ReactExample/.eslintrc.json @@ -3,9 +3,6 @@ "commonjs": true, "es6": true }, - "ecmaFeatures": { - "jsx": true - }, "globals": { "cancelAnimationFrame": false, "clearImmediate": false, @@ -19,14 +16,22 @@ "setTimeout": false }, "parser": "babel-eslint", + "parserOptions": { + "ecmaFeatures": { + "forOf": false, + "jsx": true + } + }, "plugins": [ "react" ], "rules": { + "no-console": 0, "strict": 0, "react/jsx-no-duplicate-props": 2, "react/jsx-no-undef": 2, "react/jsx-uses-react": 2, + "react/jsx-uses-vars": 2, "react/no-direct-mutation-state": 1, "react/prefer-es6-class": 1, "react/react-in-jsx-scope": 2 diff --git a/examples/ReactNativeBenchmarks/.eslintrc.json b/examples/ReactNativeBenchmarks/.eslintrc.json new file mode 120000 index 00000000..8ccb3843 --- /dev/null +++ b/examples/ReactNativeBenchmarks/.eslintrc.json @@ -0,0 +1 @@ +../ReactExample/.eslintrc.json \ No newline at end of file diff --git a/lib/.eslintrc b/lib/.eslintrc.json similarity index 100% rename from lib/.eslintrc rename to lib/.eslintrc.json diff --git a/package.json b/package.json index 0f30559c..86b9613a 100644 --- a/package.json +++ b/package.json @@ -42,10 +42,14 @@ "get-version": "echo $npm_package_version", "set-version": "scripts/set-version.sh", "jsdoc": "rm -rf docs/output && jsdoc -c docs/conf.json", + "lint": "eslint", "test": "scripts/test.sh", "prepublish": "scripts/prepublish.sh" }, "devDependencies": { + "babel-eslint": "^5.0.0", + "eslint": "^2.2.0", + "eslint-plugin-react": "^4.1.0", "jsdoc": "^3.4.0" }, "engines": { diff --git a/react-native/.eslintrc b/react-native/.eslintrc.json similarity index 66% rename from react-native/.eslintrc rename to react-native/.eslintrc.json index c027a69c..10258bfb 100644 --- a/react-native/.eslintrc +++ b/react-native/.eslintrc.json @@ -3,17 +3,22 @@ "commonjs": true, "es6": true }, - "ecmaFeatures": { - "forOf": false, - "jsx": true + "parser": "babel-eslint", + "parserOptions": { + "ecmaFeatures": { + "forOf": false, + "jsx": true + } }, "plugins": [ "react" ], "rules": { + "strict": 0, "react/jsx-no-duplicate-props": 2, "react/jsx-no-undef": 2, "react/jsx-uses-react": 2, + "react/jsx-uses-vars": 2, "react/no-direct-mutation-state": 1, "react/prefer-es6-class": 1, "react/react-in-jsx-scope": 2 diff --git a/scripts/test.sh b/scripts/test.sh index effa6409..96d9d0ca 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -75,6 +75,9 @@ if [ -s "${HOME}/.nvm/nvm.sh" ]; then fi case "$TARGET" in +"eslint") + npm run lint . + ;; "jsdoc") npm run jsdoc ;; diff --git a/tests/.eslintrc b/tests/.eslintrc deleted file mode 100644 index 766f8f24..00000000 --- a/tests/.eslintrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "env": { - "commonjs": true - }, - "ecmaFeatures": { - "forOf": true - }, - "rules": { - "no-empty": 0, - "no-unused-vars": 0 - } -} diff --git a/tests/js/.eslintrc.json b/tests/js/.eslintrc.json new file mode 100644 index 00000000..fd485029 --- /dev/null +++ b/tests/js/.eslintrc.json @@ -0,0 +1,21 @@ +{ + "env": { + "commonjs": true + }, + "globals": { + "ArrayBuffer": false, + "DataView": false, + "Float32Array": false, + "Float64Array": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false + }, + "rules": { + "no-redeclare": 1 + } +} diff --git a/tests/react-test-app/.eslintrc b/tests/react-test-app/.eslintrc.json similarity index 79% rename from tests/react-test-app/.eslintrc rename to tests/react-test-app/.eslintrc.json index 48979dc5..37f901d5 100644 --- a/tests/react-test-app/.eslintrc +++ b/tests/react-test-app/.eslintrc.json @@ -3,9 +3,6 @@ "commonjs": true, "es6": true }, - "ecmaFeatures": { - "jsx": true - }, "globals": { "cancelAnimationFrame": false, "clearImmediate": false, @@ -18,14 +15,23 @@ "setInterval": false, "setTimeout": false }, + "parser": "babel-eslint", + "parserOptions": { + "ecmaFeatures": { + "forOf": false, + "jsx": true + } + }, "plugins": [ "react" ], "rules": { "no-console": 0, + "strict": 0, "react/jsx-no-duplicate-props": 2, "react/jsx-no-undef": 2, "react/jsx-uses-react": 2, + "react/jsx-uses-vars": 2, "react/no-direct-mutation-state": 1, "react/prefer-es6-class": 1, "react/react-in-jsx-scope": 2