Upgrade to eslint-config-amo v4 (#9915)

This commit is contained in:
William Durand 2020-12-11 15:32:28 +01:00 коммит произвёл GitHub
Родитель 3b21e19103
Коммит ae96b7cb47
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 89 добавлений и 55 удалений

Просмотреть файл

@ -43,9 +43,6 @@
"BodyInit": true
},
"parser": "babel-eslint",
"plugins": [
"jest"
],
"rules": {
// These rules are not compatible with Prettier.
"implicit-arrow-linebreak": "off",
@ -61,7 +58,10 @@
"react/default-props-match-prop-types": "off",
// This rule is disabled because it outputs a lot of false positives, see:
// https://github.com/benmosher/eslint-plugin-import/issues/1343
"import/no-cycle": "off"
"import/no-cycle": "off",
// This rule is only a warning but it is too noisy: we have test cases
// without `expect` because we're using `sinon` too.
"jest/expect-expect": "off"
},
"settings": {
"import/core-modules": [

Просмотреть файл

@ -302,7 +302,7 @@
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "^1.5.0",
"eslint": "7.15.0",
"eslint-config-amo": "^3.6.1",
"eslint-config-amo": "^4.0.0",
"eslint-plugin-amo": "^1.9.1",
"eslint-plugin-promise": "^4.0.0",
"file-loader": "^6.0.0",
@ -368,4 +368,4 @@
"maxSize": "33 kB"
}
]
}
}

Просмотреть файл

@ -326,11 +326,15 @@ describe(__filename, () => {
});
describe('categoryResultsLinkTo', () => {
const addonType = ADDON_TYPE_EXTENSION;
const slug = 'some-slug';
it('returns a "to" object', () => {
const addonType = ADDON_TYPE_EXTENSION;
const slug = 'some-slug';
const toValue = categoryResultsLinkTo({ addonType, slug });
expect(toValue.pathname).toEqual('/search/');
expect(toValue.query).toEqual(getCategoryResultsQuery({ addonType, slug }));
const toValue = categoryResultsLinkTo({ addonType, slug });
expect(toValue.pathname).toEqual('/search/');
expect(toValue.query).toEqual(
getCategoryResultsQuery({ addonType, slug }),
);
});
});
});

Просмотреть файл

@ -704,7 +704,7 @@ describe(__filename, () => {
});
});
describe('logOutFromServer', async () => {
describe('logOutFromServer', () => {
it('makes a delete request to the session endpoint', async () => {
const { state } = dispatchSignInActions();

Просмотреть файл

@ -114,10 +114,12 @@ describe(__filename, () => {
});
describe('setRequestId', () => {
const requestId = 'uuid4-set-by-middleware';
const state = api(undefined, actions.setRequestId(requestId));
it('stores a request ID', () => {
const requestId = 'uuid4-set-by-middleware';
const state = api(undefined, actions.setRequestId(requestId));
expect(state.requestId).toEqual(requestId);
expect(state.requestId).toEqual(requestId);
});
});
describe('setLang', () => {

Просмотреть файл

@ -8,6 +8,7 @@ import {
} from 'core/constants';
import errors, { initialState } from 'core/reducers/errors';
// eslint-disable-next-line jest/no-export
export function createFakeApiError({ fieldErrors = {}, nonFieldErrors } = {}) {
const response = {
ok: false,

Просмотреть файл

@ -65,6 +65,7 @@ const StubApp = () => (
</div>
);
// eslint-disable-next-line jest/no-export
export class ServerTestHelper {
constructor() {
this.helmetCanUseDOM = Helmet.canUseDOM;

Просмотреть файл

@ -11,6 +11,7 @@ describe(__filename, () => {
const basePath = path.join(__dirname, 'fixtures');
const versionJson = fs.readJsonSync(path.join(basePath, 'version.json'));
// eslint-disable-next-line jest/no-done-callback
it('exposes the version.json file', (done) => {
const _config = getFakeConfig({ basePath });
const handler = viewFrontendVersionHandler({ _config });
@ -29,6 +30,7 @@ describe(__filename, () => {
});
});
// eslint-disable-next-line jest/no-done-callback
it('exposes the experiments and feature flags', (done) => {
const experiments = {
ab_test_1: true,
@ -60,6 +62,7 @@ describe(__filename, () => {
});
});
// eslint-disable-next-line jest/no-done-callback
it('returns a 415 and logs an error when file does not exist', (done) => {
const _config = getFakeConfig({ basePath: '/some/invalid/path' });
const _log = getFakeLogger();

Просмотреть файл

@ -34,9 +34,11 @@ describe(__filename, () => {
describe('Check Locale JS files', () => {
for (const localeJSFile of glob.sync('src/locale/*/*.js')) {
// eslint-disable-next-line jest/no-done-callback
it(`${localeJSFile} should not have html entities`, (done) => {
fs.readFile(localeJSFile, 'utf8', (err, data) => {
if (!err) {
// eslint-disable-next-line jest/no-conditional-expect
expect(/&[^\s]+;/.test(data)).toBeFalsy();
} else {
throw new Error(err);
@ -63,6 +65,7 @@ describe(__filename, () => {
// are skipped in plural forms.
if (translation && numberTranslationMatches === 1) {
for (const match of placeholderMatches) {
// eslint-disable-next-line jest/no-conditional-expect
expect(translation).toContain(match);
}
}

Просмотреть файл

@ -26,6 +26,7 @@ describe(__filename, () => {
Object.keys(packageJson.devDependencies).forEach((key) => {
it(`should have devDependencies[${key}] version prefixed with "^"`, () => {
if (!skipDevDeps.includes(key)) {
// eslint-disable-next-line jest/no-conditional-expect
expect(packageJson.devDependencies[key]).toEqual(
expect.stringMatching(/^(\^|git)/),
);

Просмотреть файл

@ -3808,10 +3808,10 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
axe-core@^3.5.4:
version "3.5.5"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-3.5.5.tgz#84315073b53fa3c0c51676c588d59da09a192227"
integrity sha512-5P0QZ6J5xGikH780pghEdbEKijCTrruK9KxtPZCFWUpef0f6GipO+xEZ5GKCb020mmqgbiNO6TcA55CriL784Q==
axe-core@^4.0.2:
version "4.1.1"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.1.1.tgz#70a7855888e287f7add66002211a423937063eaf"
integrity sha512-5Kgy8Cz6LPC9DJcNb3yjAXTu3XihQgEdnIg50c//zOC/MyLP0Clg+Y8Sh9ZjjnvBrDZU4DgXS9C3T9r4/scGZQ==
axios@0.19.0:
version "0.19.0"
@ -3828,7 +3828,7 @@ axios@^0.19.0:
dependencies:
follow-redirects "1.5.10"
axobject-query@^2.1.2:
axobject-query@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
integrity sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA==
@ -6834,7 +6834,7 @@ escodegen@^1.12.0, escodegen@^1.14.1, escodegen@^1.9.1:
optionalDependencies:
source-map "~0.6.1"
eslint-config-airbnb-base@^14.2.0:
eslint-config-airbnb-base@^14.2.1:
version "14.2.1"
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz#8a2eb38455dc5a312550193b319cdaeef042cd1e"
integrity sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==
@ -6843,25 +6843,33 @@ eslint-config-airbnb-base@^14.2.0:
object.assign "^4.1.2"
object.entries "^1.1.2"
eslint-config-airbnb@18.2.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-18.2.0.tgz#8a82168713effce8fc08e10896a63f1235499dcd"
integrity sha512-Fz4JIUKkrhO0du2cg5opdyPKQXOI2MvF8KUvN2710nJMT6jaRUpRE2swrJftAjVGL7T1otLM5ieo5RqS1v9Udg==
eslint-config-airbnb@18.2.1:
version "18.2.1"
resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-18.2.1.tgz#b7fe2b42f9f8173e825b73c8014b592e449c98d9"
integrity sha512-glZNDEZ36VdlZWoxn/bUR1r/sdFKPd1mHPbqUtkctgNG4yT2DLLtJ3D+yCV+jzZCc2V1nBVkmdknOJBZ5Hc0fg==
dependencies:
eslint-config-airbnb-base "^14.2.0"
object.assign "^4.1.0"
eslint-config-airbnb-base "^14.2.1"
object.assign "^4.1.2"
object.entries "^1.1.2"
eslint-config-amo@^3.6.1:
version "3.9.0"
resolved "https://registry.yarnpkg.com/eslint-config-amo/-/eslint-config-amo-3.9.0.tgz#2c4ff235200b8e3a5d7e5595c86cc9041086585a"
integrity sha512-xB27i0waZp19RkmliGNWiU/7wy4oFOVITLwyQb50OwbcK6p+j1pJj1Q4r6Q62kypcbvDxJjZv03IZQEsconuWg==
eslint-config-amo@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-amo/-/eslint-config-amo-4.0.0.tgz#b36014edf27c38c10f223dc6218c3f5d27c11d74"
integrity sha512-3vzI9nnsao5STpgTmguY3DA5U/cgboKtshRQPWFXCEZ7sy+HW/GJoZPSefuhhGgUloR0hkEnPsN7ipqkYNBbsg==
dependencies:
eslint-config-airbnb "18.2.0"
eslint-config-airbnb "18.2.1"
eslint-config-prettier "7.0.0"
eslint-plugin-import "2.22.1"
eslint-plugin-jest "24.1.0"
eslint-plugin-jsx-a11y "6.3.1"
eslint-plugin-jest "24.1.3"
eslint-plugin-jsx-a11y "6.4.1"
eslint-plugin-prettier "3.2.0"
eslint-plugin-react "7.21.5"
eslint-plugin-react-hooks "4.2.0"
eslint-config-prettier@7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-7.0.0.tgz#c1ae4106f74e6c0357f44adb076771d032ac0e97"
integrity sha512-8Y8lGLVPPZdaNA7JXqnvETVC7IiVRgAP6afQu9gOQRn90YY3otMNh+x7Vr2vMePQntF+5erdSUBqSzCmU/AxaQ==
eslint-import-resolver-node@^0.3.4:
version "0.3.4"
@ -6906,30 +6914,37 @@ eslint-plugin-import@2.22.1:
resolve "^1.17.0"
tsconfig-paths "^3.9.0"
eslint-plugin-jest@24.1.0:
version "24.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.1.0.tgz#6708037d7602e5288ce877fd0103f329dc978361"
integrity sha512-827YJ+E8B9PvXu/0eiVSNFfxxndbKv+qE/3GSMhdorCaeaOehtqHGX2YDW9B85TEOre9n/zscledkFW/KbnyGg==
eslint-plugin-jest@24.1.3:
version "24.1.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.1.3.tgz#fa3db864f06c5623ff43485ca6c0e8fc5fe8ba0c"
integrity sha512-dNGGjzuEzCE3d5EPZQ/QGtmlMotqnYWD/QpCZ1UuZlrMAdhG5rldh0N0haCvhGnUkSeuORS5VNROwF9Hrgn3Lg==
dependencies:
"@typescript-eslint/experimental-utils" "^4.0.1"
eslint-plugin-jsx-a11y@6.3.1:
version "6.3.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.3.1.tgz#99ef7e97f567cc6a5b8dd5ab95a94a67058a2660"
integrity sha512-i1S+P+c3HOlBJzMFORRbC58tHa65Kbo8b52/TwCwSKLohwvpfT5rm2GjGWzOHTEuq4xxf2aRlHHTtmExDQOP+g==
eslint-plugin-jsx-a11y@6.4.1:
version "6.4.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.4.1.tgz#a2d84caa49756942f42f1ffab9002436391718fd"
integrity sha512-0rGPJBbwHoGNPU73/QCLP/vveMlM1b1Z9PponxO87jfr6tuH5ligXbDT6nHSSzBC8ovX2Z+BQu7Bk5D/Xgq9zg==
dependencies:
"@babel/runtime" "^7.10.2"
"@babel/runtime" "^7.11.2"
aria-query "^4.2.2"
array-includes "^3.1.1"
ast-types-flow "^0.0.7"
axe-core "^3.5.4"
axobject-query "^2.1.2"
axe-core "^4.0.2"
axobject-query "^2.2.0"
damerau-levenshtein "^1.0.6"
emoji-regex "^9.0.0"
has "^1.0.3"
jsx-ast-utils "^2.4.1"
jsx-ast-utils "^3.1.0"
language-tags "^1.0.5"
eslint-plugin-prettier@3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.2.0.tgz#af391b2226fa0e15c96f36c733f6e9035dbd952c"
integrity sha512-kOUSJnFjAUFKwVxuzy6sA5yyMx6+o9ino4gCdShzBNx4eyFRudWRYKCFolKjoM40PEiuU6Cn7wBLfq3WsGg7qg==
dependencies:
prettier-linter-helpers "^1.0.0"
eslint-plugin-promise@^4.0.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz#845fd8b2260ad8f82564c1222fce44ad71d9418a"
@ -7317,6 +7332,11 @@ fast-deep-equal@^3.1.1:
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
fast-diff@^1.1.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
fast-glob@^2.0.2, fast-glob@^2.2.6:
version "2.2.7"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d"
@ -10352,15 +10372,7 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.10.0"
jsx-ast-utils@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.4.1.tgz#1114a4c1209481db06c690c2b4f488cc665f657e"
integrity sha512-z1xSldJ6imESSzOjd3NNkieVJKRlKYSOtMG8SFyCj2FIrvSaSuli/WjpBkEzCBoR9bYYYFgqJw61Xhu7Lcgk+w==
dependencies:
array-includes "^3.1.1"
object.assign "^4.1.0"
"jsx-ast-utils@^2.4.1 || ^3.0.0":
"jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.1.0.tgz#642f1d7b88aa6d7eb9d8f2210e166478444fa891"
integrity sha512-d4/UOjg+mxAWxCiF0c5UTSwyqbchkbqCvK87aBovhnh8GtysTjWmgC63tY0cJx/HzGgm9qnA147jVBdpOiQ2RA==
@ -13294,6 +13306,13 @@ preserve@^0.2.0:
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
prettier-linter-helpers@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
dependencies:
fast-diff "^1.1.2"
prettier@2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"