Upgrade ESLint to v8 (#3984)
This commit is contained in:
Родитель
3d1e12cb03
Коммит
2e9ab54473
14
.eslintrc
14
.eslintrc
|
@ -1,20 +1,16 @@
|
|||
{
|
||||
"rules":{
|
||||
"no-console": 0,
|
||||
// Inherited from airbnb via eslint-config-amo
|
||||
"function-paren-newline": 0
|
||||
"rules": {
|
||||
// This project uses `console.log()`.
|
||||
"no-console": "off"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"es6": true,
|
||||
},
|
||||
"extends": ["amo"],
|
||||
"parser": "babel-eslint",
|
||||
"plugins": ["async-await"],
|
||||
"extends": ["amo/base"],
|
||||
"parser": "@babel/eslint-parser",
|
||||
"settings": {
|
||||
"async-await/space-after-async": 2,
|
||||
"async-await/space-after-await": 2,
|
||||
"import/resolver": {
|
||||
"node": {
|
||||
// This adds ./src for relative imports.
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
12
package.json
12
package.json
|
@ -45,7 +45,7 @@
|
|||
"dependencies": {
|
||||
"@mdn/browser-compat-data": "4.0.8",
|
||||
"addons-moz-compare": "1.2.0",
|
||||
"addons-scanner-utils": "5.0.0",
|
||||
"addons-scanner-utils": "6.1.0",
|
||||
"ajv": "6.12.6",
|
||||
"ajv-merge-patch": "4.1.0",
|
||||
"chalk": "4.1.2",
|
||||
|
@ -54,8 +54,8 @@
|
|||
"common-tags": "1.8.0",
|
||||
"deepmerge": "4.2.2",
|
||||
"dispensary": "0.62.0",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-plugin-no-unsanitized": "3.2.0",
|
||||
"eslint": "8.1.0",
|
||||
"eslint-plugin-no-unsanitized": "4.0.0",
|
||||
"eslint-visitor-keys": "3.0.0",
|
||||
"espree": "9.0.0",
|
||||
"esprima": "4.0.1",
|
||||
|
@ -78,6 +78,7 @@
|
|||
"devDependencies": {
|
||||
"@babel/cli": "7.16.0",
|
||||
"@babel/core": "7.16.0",
|
||||
"@babel/eslint-parser": "7.15.8",
|
||||
"@babel/plugin-proposal-class-properties": "7.16.0",
|
||||
"@babel/plugin-proposal-decorators": "7.16.0",
|
||||
"@babel/plugin-proposal-export-namespace-from": "7.16.0",
|
||||
|
@ -87,15 +88,12 @@
|
|||
"@babel/preset-env": "7.16.0",
|
||||
"@babel/register": "7.16.0",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-eslint": "10.1.0",
|
||||
"babel-gettext-extractor": "4.1.3",
|
||||
"babel-jest": "27.3.1",
|
||||
"babel-loader": "8.2.3",
|
||||
"comment-json": "4.1.1",
|
||||
"doctoc": "2.1.0",
|
||||
"eslint-config-amo": "4.11.0",
|
||||
"eslint-plugin-async-await": "0.0.0",
|
||||
"eslint-plugin-promise": "5.1.1",
|
||||
"eslint-config-amo": "5.1.0",
|
||||
"github-markdown-css": "5.0.0",
|
||||
"gunzip-maybe": "1.4.2",
|
||||
"hashish": "0.0.4",
|
||||
|
|
|
@ -3,28 +3,24 @@
|
|||
"jest": true,
|
||||
"jest/globals": true,
|
||||
},
|
||||
"extends": [
|
||||
"plugin:promise/recommended",
|
||||
],
|
||||
"globals": {
|
||||
"assert": true,
|
||||
"sinon": true,
|
||||
},
|
||||
"plugins": [
|
||||
"jest",
|
||||
"promise",
|
||||
],
|
||||
"plugins": ["jest"],
|
||||
"rules": {
|
||||
"import/no-extraneous-dependencies": ["error", {
|
||||
// Allow dev-dependencies in this directory.
|
||||
"devDependencies": true
|
||||
}],
|
||||
"jest/expect-expect": ["warn", {
|
||||
// Allow Jest or Sinon assertions
|
||||
"assertFunctionNames": ["expect", "sinon.assert.*"]
|
||||
// Register the custom matchers we use in this project.
|
||||
"assertFunctionNames": [
|
||||
"expect",
|
||||
"sinon.assert.*",
|
||||
"assertHasMatchingError",
|
||||
"checkMinNodeVersion",
|
||||
],
|
||||
}],
|
||||
"promise/always-return": "off",
|
||||
"promise/avoid-new": "off",
|
||||
"promise/no-nesting": "off",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -2978,11 +2978,13 @@ describe('ManifestJSONParser', () => {
|
|||
];
|
||||
|
||||
for (const invalidUrl of testInvalidUrls) {
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it(`should fail on forbidden homepage_url "${invalidUrl}"`, () => {
|
||||
return testHomepageUrl(invalidUrl, false);
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('should not mark non forbidden homepage url as invalid', () => {
|
||||
return testHomepageUrl('http://test.org', true);
|
||||
});
|
||||
|
|
|
@ -102,11 +102,13 @@ describe('HTML', () => {
|
|||
expect(linterMessages.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('should not blow up when handed malformed HTML', async () => {
|
||||
it('should not blow up when handed malformed HTML', () => {
|
||||
const html = validHTML('<div>Howdy <!-- >');
|
||||
const htmlScanner = new HTMLScanner(html, 'index.html');
|
||||
|
||||
await htmlScanner.scan();
|
||||
expect(async () => {
|
||||
await htmlScanner.scan();
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('should return an already-parsed htmlDoc if exists', async () => {
|
||||
|
|
|
@ -121,9 +121,7 @@ describe('JavaScript Scanner', () => {
|
|||
expect(linterMessages).toEqual([]);
|
||||
});
|
||||
|
||||
// See: https://github.com/tc39/proposal-class-fields
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
it.skip('should support public class fields', async () => {
|
||||
it('should support public class fields', async () => {
|
||||
const code = 'class MyClass { a = 1; }';
|
||||
|
||||
const jsScanner = new JavaScriptScanner(code, 'code.js');
|
||||
|
@ -286,7 +284,7 @@ describe('JavaScript Scanner', () => {
|
|||
// don't change behaviour on us.
|
||||
// https://github.com/mozilla/addons-linter/pull/98#issuecomment-158890847
|
||||
it('ignores /*global foo*/', () => {
|
||||
const eslint = ESLint.linter;
|
||||
const eslint = new ESLint.Linter();
|
||||
const config = { rules: { test: 2 } };
|
||||
let ok = false;
|
||||
|
||||
|
|
|
@ -681,7 +681,7 @@ describe('Linter.textOutput()', () => {
|
|||
addonLinter.textOutput(uselesslyTinyTerminalWidth);
|
||||
expect(addonLinter.output.summary.errors).toEqual(1);
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line jest/no-conditional-expect, jest/no-try-expect
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(false).toBe(true);
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче