Skip to content

Commit

Permalink
[chore] Update eslint dep (#2000)
Browse files Browse the repository at this point in the history
* Updates eslint-config to 1.5.0 along with necessary updates to peer dependencies
* Disable no-undef rule
* Disable rules that we werent previously complying with for eslint:recommended
* Add explicit rules names to disables
* Fix bug in test and remove redundant doublebang
* Fix sparse array in test
  • Loading branch information
sirugh authored and tjwiebell committed Dec 4, 2019
1 parent f4ed209 commit 4c00165
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 26 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const config = {
parser: 'babel-eslint',
extends: ['@magento']
extends: ['@magento'],
rules: {
'no-undef': 'off',
'no-useless-escape': 'off'
}
};

module.exports = config;
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,20 @@
"watch:venia": "yarn venia run watch"
},
"devDependencies": {
"@magento/eslint-config": "~1.4.1",
"@magento/eslint-config": "~1.5.0",
"@types/jest": "~24.0.18",
"caller-id": "~0.1.0",
"chalk": "~2.4.2",
"chokidar": "~2.1.2",
"coveralls": "~3.0.3",
"danger": "^7.1.4",
"eslint": "~5.14.1",
"eslint-config-prettier": "~6.0.0",
"eslint-plugin-babel": "~5.3.0",
"eslint-plugin-graphql": "~3.0.3",
"eslint-plugin-jsx-a11y": "~6.2.1",
"eslint-plugin-node": "~8.0.1",
"eslint-plugin-package-json": "~0.1.3",
"eslint-plugin-package-json": "~0.1.4",
"eslint-plugin-react": "~7.12.4",
"eslint-plugin-react-hooks": "~2.0.1",
"execa": "~1.0.0",
Expand Down
6 changes: 5 additions & 1 deletion packages/peregrine/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const config = {
parser: 'babel-eslint',
extends: ['@magento']
extends: ['@magento'],
rules: {
'no-undef': 'off',
'no-useless-escape': 'off'
}
};

module.exports = config;
1 change: 1 addition & 0 deletions packages/peregrine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"homepage": "https://github.com/magento/pwa-studio/tree/master/packages/peregrine#readme",
"devDependencies": {
"@magento/eslint-config": "~1.5.0",
"intl": "~1.2.5",
"react": "~16.9.0",
"react-dom": "~16.9.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/pwa-buildpack/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const config = {
node: {
allowModules: uniqueRootModules
}
},
rules: {
'no-undef': 'off',
'no-useless-escape': 'off'
}
};

Expand Down
1 change: 1 addition & 0 deletions packages/pwa-buildpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"yargs": "~13.2.2"
},
"devDependencies": {
"@magento/eslint-config": "~1.5.0",
"memory-fs": "~0.4.1",
"rimraf": "~2.6.3",
"sharp": "~0.22.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/upward-js/lib/IOAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ class IOAdapter {
* @param {string} [encoding] Character set, e.g. 'utf-8'.
* @return {Promise<string|Buffer>} Promise for file contents.
*/
async readFile(filePath, encoding) {} //eslint-disable-line
async readFile(filePath, encoding) {} //eslint-disable-line no-unused-vars

/**
* Works like `node-fetch`. (Injected for testability.)
* @param {string|URL} URL URL to fetch.
* @param {object} options Fetch options, see node-fetch docs.
* @return {Promise<Response>}
*/
async networkFetch(url, options) {} //eslint-disable-line
async networkFetch(url, options) {} //eslint-disable-line no-unused-vars
}

module.exports = IOAdapter;
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ test('throws if template engine is unsupported', async () => {
}[dfn[name]])
),
context: {
get: jest.fn(() => {
ENV_VAR: 'ENV_VALUE';
})
get: jest.fn(() => ({
ENV_VAR: 'ENV_VALUE'
}))
}
};
await expect(
Expand Down
2 changes: 1 addition & 1 deletion packages/upward-spec/suite/assertOnResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = async (t, response, expected) => {
let errors;
try {
errors = JSON.parse(errorText).errors;
} catch (e) {}
} catch (e) {} //eslint-disable-line no-empty
if (!errors || !Array.isArray(errors) || errors.length === 0) {
return t.fail(
`Error: Expected ${inspect(
Expand Down
6 changes: 5 additions & 1 deletion packages/venia-concept/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const config = {
parser: 'babel-eslint',
extends: ['@magento']
extends: ['@magento'],
rules: {
'no-undef': 'off',
'no-useless-escape': 'off'
}
};

module.exports = config;
4 changes: 2 additions & 2 deletions packages/venia-concept/_buildpack/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function createProjectFromVenia({ fs, tasks, options }) {
pkg.scripts[name] = toPackageScript(scriptsToInsert[name]);
});

if (!!process.env.DEBUG_PROJECT_CREATION) {
if (process.env.DEBUG_PROJECT_CREATION) {
setDebugDependencies(fs, pkg);
}

Expand Down Expand Up @@ -125,7 +125,7 @@ function setDebugDependencies(fs, pkg) {
let name;
try {
name = fs.readJsonSync(resolve(packagePath, 'package.json')).name;
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty
if (
// these should not be deps
!name ||
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@babel/preset-env": "~7.3.4",
"@babel/runtime": "~7.4.2",
"@magento/babel-preset-peregrine": "~1.0.0",
"@magento/eslint-config": "~1.4.0",
"@magento/eslint-config": "~1.5.0",
"@magento/peregrine": "~4.0.0",
"@magento/pwa-buildpack": "~4.0.0",
"@magento/upward-js": "~3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ jest.mock('@apollo/react-hooks', () => ({
}));

jest.mock('@magento/peregrine/lib/context/app', () => {
const useAppContext = jest.fn(() => [
,
{
toggleDrawer: jest.fn()
}
]);
const state = {};
const api = { toggleDrawer: jest.fn() };
const useAppContext = jest.fn(() => [state, api]);

return { useAppContext };
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ToastEmitter = ({
setTimeout(() => {
addToast(toastProps);
}, 0);
}, []); // eslint-disable-line
}, []); // eslint-disable-line react-hooks/exhaustive-deps

return null;
};
Expand Down
2 changes: 2 additions & 0 deletions scripts/jest-magic-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ if (!process.env.DEBUG && !process.env.NODE_DEBUG) {
// in both node and jsdom, the console methods are own properties, so we
// can just iterate through them to replace them all
for (const method of Object.keys(realConsole)) {
/* eslint-disable no-inner-declarations */
// declare the function instead of inlining it because we need a
// reference to it to get the correct stacktrace
function methodProxy() {
Expand All @@ -39,6 +40,7 @@ if (!process.env.DEBUG && !process.env.NODE_DEBUG) {
// otherwise, assume that the application code is calling the
// console, and don't output it.
}
/* eslint-enable no-inner-declarations */
// building the descriptors object method by method
descriptors[method] = {
value: methodProxy,
Expand Down
59 changes: 54 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2219,10 +2219,10 @@
dependencies:
es-comments "^1.0.1"

"@magento/eslint-config@~1.4.0", "@magento/eslint-config@~1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@magento/eslint-config/-/eslint-config-1.4.1.tgz#8c4ea4d91e3f314ee21dee8f113c5588fdf595df"
integrity sha512-HKo5qt4Y13SFzTpTHp3mHQQgQ8G/WH60b4hgn3DweWsCL9I+CMjpN5io74l8rYvqj/87BQ94nhQif69HQ+s0sw==
"@magento/eslint-config@~1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@magento/eslint-config/-/eslint-config-1.5.0.tgz#d79b143f1bc29b6f14499c11808591715584aa99"
integrity sha512-Mc1qvlj08rnxmTafJPgADkOJR9dRU84iXxVdWxjkTIw2tiB6DIViYWCpn7B37Gq6SJriESu1Ec0NqJBEBHV/OA==

"@magento/express-sharp@~3.0.0":
version "3.0.0"
Expand Down Expand Up @@ -2787,6 +2787,11 @@
"@types/connect" "*"
"@types/node" "*"

"@types/color-name@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==

"@types/configstore@^2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@types/configstore/-/configstore-2.1.1.tgz#cd1e8553633ad3185c3f2f239ecff5d2643e92b6"
Expand Down Expand Up @@ -3442,6 +3447,14 @@ ansi-styles@^3.1.0, ansi-styles@^3.2.0, ansi-styles@^3.2.1:
dependencies:
color-convert "^1.9.0"

ansi-styles@^4.1.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.0.tgz#5681f0dcf7ae5880a7841d8831c4724ed9cc0172"
integrity sha512-7kFQgnEaMdRtwf6uSfUnVr9gSGC7faurn+J/Mv90/W+iTtN0405/nLdopfMWwchyxhbGYl6TC4Sccn9TUkGAgg==
dependencies:
"@types/color-name" "^1.1.1"
color-convert "^2.0.1"

anymatch@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb"
Expand Down Expand Up @@ -5507,12 +5520,19 @@ color-convert@^1.9.0, color-convert@^1.9.1:
dependencies:
color-name "1.1.3"

color-convert@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
dependencies:
color-name "~1.1.4"

color-name@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=

color-name@^1.0.0:
color-name@^1.0.0, color-name@~1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
Expand Down Expand Up @@ -6620,6 +6640,11 @@ diff@^2.2.1:
resolved "https://registry.yarnpkg.com/diff/-/diff-2.2.3.tgz#60eafd0d28ee906e4e8ff0a52c1229521033bf99"
integrity sha1-YOr9DSjukG5Oj/ClLBIpUhAzv5k=

diff@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff"
integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==

diffie-hellman@^5.0.0:
version "5.0.3"
resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875"
Expand Down Expand Up @@ -6657,6 +6682,14 @@ disparity@^2.0.0:
ansi-styles "^2.0.1"
diff "^1.3.2"

disparity@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/disparity/-/disparity-3.0.0.tgz#605288e8ebf38c5ccfe1e0dbc49ca6f724096500"
integrity sha512-n94Rzbv2ambRaFzrnBf34IEiyOdIci7maRpMkoQWB6xFYGA7Nbs0Z5YQzMfTeyQeelv23nayqOcssBoc6rKrgw==
dependencies:
ansi-styles "^4.1.0"
diff "^4.0.1"

dns-equal@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d"
Expand Down Expand Up @@ -7087,6 +7120,13 @@ escodegen@^1.9.1:
optionalDependencies:
source-map "~0.6.1"

eslint-config-prettier@~6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz#f429a53bde9fc7660e6353910fd996d6284d3c25"
integrity sha512-vDrcCFE3+2ixNT5H83g28bO/uYAwibJxerXPj+E7op4qzBCsAV36QfvdAyVOoNxKAH2Os/e01T/2x++V0LPukA==
dependencies:
get-stdin "^6.0.0"

eslint-plugin-babel@~5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-5.3.0.tgz#2e7f251ccc249326da760c1a4c948a91c32d0023"
Expand Down Expand Up @@ -7146,6 +7186,15 @@ eslint-plugin-package-json@~0.1.3:
package-json-validator "^0.6.3"
requireindex "^1.2.0"

eslint-plugin-package-json@~0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/eslint-plugin-package-json/-/eslint-plugin-package-json-0.1.4.tgz#88ad9ec30f28795c51e9001d4d8294c78889ad7a"
integrity sha512-qdb9LUBFR3tM9OZM1AaYCkxoZnRx7PX2xqvLm49D0JbUu+EkbDur9ug+tCS2xlA1Lbt12Wff5qES81ttc/VBdg==
dependencies:
disparity "^3.0.0"
package-json-validator "^0.6.3"
requireindex "^1.2.0"

eslint-plugin-react-hooks@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.0.1.tgz#e898ec26a0a335af6f7b0ad1f0bedda7143ed756"
Expand Down

0 comments on commit 4c00165

Please # to comment.