Bug 1553917 - Enable eslint for browser/components/newtab r=Mardak

Differential Revision: https://phabricator.services.mozilla.com/D32373

--HG--
extra : moz-landing-system : lando
This commit is contained in:
k88hudson 2019-05-28 20:24:23 +00:00
parent b90935eec1
commit 8c8bb77fbf
6 changed files with 48 additions and 56 deletions

View file

@ -63,8 +63,15 @@ browser/extensions/pdfjs/content/web**
# generated or library files in pocket
browser/components/pocket/content/panels/js/tmpl.js
browser/components/pocket/content/panels/js/vendor/**
# Activity Stream has incompatible eslintrc. `npm run lint` from its directory
browser/components/newtab/**
# Ignore newtab files
# Kept in sync with browser/components/newtab/.eslintignore
browser/components/newtab/bin/prerender.js
browser/components/newtab/data/
browser/components/newtab/logs/
browser/components/newtab/prerendered/
browser/components/newtab/vendor/
# The only file in browser/locales/ is pre-processed.
browser/locales/**
# imported from chromium

View file

@ -1,11 +1,5 @@
activity-streams-env/
dist/
firefox/
logs/
stats.json
prerendered/
bin/prerender.js
data/
logs/
prerendered/
vendor/
data/
bin/prerender.js
bin/prerender.js.map
aboutlibrary/content/

View file

@ -13,11 +13,12 @@ module.exports = {
},
"plugins": [
"import", // require("eslint-plugin-import")
"json", // require("eslint-plugin-json")
"promise", // require("eslint-plugin-promise")
"react", // require("eslint-plugin-react")
"react-hooks", // require("react-hooks")
"fetch-options", // require("eslint-plugin-fetch-options")
"jsx-a11y" // require("eslint-plugin-jsx-a11y")
// Temporarily disabled since they aren't vendored into in mozilla central yet
// "react-hooks", // require("react-hooks")
// "fetch-options", // require("eslint-plugin-fetch-options")
],
"settings": {
"react": {
@ -25,7 +26,9 @@ module.exports = {
}
},
"extends": [
"eslint:recommended",
"plugin:jsx-a11y/recommended", // require("eslint-plugin-jsx-a11y")
"plugin:mozilla/recommended", // require("eslint-plugin-mozilla")
"plugin:mozilla/browser-test",
"plugin:mozilla/mochitest-test",
@ -36,26 +39,36 @@ module.exports = {
"RPMSendAsyncMessage": true,
"NewTabPagePreloading": true,
},
"overrides": [{
// Use a configuration that's more appropriate for JSMs
"files": "**/*.jsm",
"parserOptions": {
"sourceType": "script"
"overrides": [
{
// These files use fluent-dom to insert content
"files": [
"content-src/asrouter/templates/OnboardingMessage/**",
"content-src/asrouter/templates/Trailhead/**",
],
"rules": {
"jsx-a11y/anchor-has-content": 0,
"jsx-a11y/heading-has-content": 0,
}
},
"env": {
"node": false
},
"rules": {
"no-implicit-globals": 0
{
// Use a configuration that's more appropriate for JSMs
"files": "**/*.jsm",
"parserOptions": {
"sourceType": "script"
},
"env": {
"node": false
},
"rules": {
"no-implicit-globals": 0
}
}
}],
],
"rules": {
"react-hooks/rules-of-hooks": 2,
// "react-hooks/rules-of-hooks": 2,
"fetch-options/no-fetch-credentials": 2,
"promise/catch-or-return": 2,
"promise/param-names": 2,
// "fetch-options/no-fetch-credentials": 2,
"react/jsx-boolean-value": [2, "always"],
"react/jsx-closing-bracket-location": [2, "after-props"],

View file

@ -1,17 +0,0 @@
module.exports = {
"plugins": [
"jsx-a11y" // require("eslint-plugin-jsx-a11y")
],
"extends": "plugin:jsx-a11y/recommended",
"overrides": [{
// These files use fluent-dom to insert content
"files": [
"content-src/asrouter/templates/OnboardingMessage/**",
"content-src/asrouter/templates/Trailhead/**",
],
"rules": {
"jsx-a11y/anchor-has-content": 0,
"jsx-a11y/heading-has-content": 0,
}
}],
};

View file

@ -33,14 +33,11 @@
"eslint": "5.16.0",
"eslint-plugin-fetch-options": "0.0.4",
"eslint-plugin-import": "2.17.2",
"eslint-plugin-json": "1.4.0",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-mozilla": "1.2.1",
"eslint-plugin-no-unsanitized": "3.0.2",
"eslint-plugin-promise": "4.1.1",
"eslint-plugin-react": "7.12.4",
"eslint-plugin-react-hooks": "1.6.0",
"eslint-watch": "5.1.2",
"istanbul-instrumenter-loader": "3.0.1",
"joi-browser": "13.4.0",
"karma": "4.1.0",
@ -131,8 +128,7 @@
"tddmc": "karma start karma.mc.config.js --tdd",
"debugcoverage": "open logs/coverage/index.html",
"lint": "npm-run-all lint:*",
"lint:eslint": "esw --ext=.js,.jsm,.json,.jsx .",
"lint:jsx-a11y": "esw --config=.eslintrc.jsx-a11y.js --ext=.jsx content-src/",
"lint:eslint": "eslint --ext=.js,.jsm,.jsx .",
"lint:sasslint": "sass-lint -v -q",
"strings-import": "node ./bin/strings-import.js",
"test": "npm run testmc",

View file

@ -63,8 +63,7 @@ scripts:
# lint: Run eslint and sass-lint
lint:
eslint: esw --ext=.js,.jsm,.json,.jsx .
jsx-a11y: esw --config=.eslintrc.jsx-a11y.js --ext=.jsx content-src/
eslint: eslint --ext=.js,.jsm,.jsx .
sasslint: sass-lint -v -q
# strings-import: Replace local strings with those from l10n-central