Skip to content

Commit

Permalink
Upgrade ESLint et al to the latest versions (#3278)
Browse files Browse the repository at this point in the history
  • Loading branch information
pugnascotia authored Apr 8, 2020
1 parent 19cbb7f commit b2a2212
Show file tree
Hide file tree
Showing 9 changed files with 646 additions and 212 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ eui.d.ts
**/assets/**/*.js
src-docs/src/views/icon/icon_example.js
src-framer/code/canvas.tsx
packages/react-datepicker/examples
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ module.exports = {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",

"@typescript-eslint/array-type": ["error", "array-simple"],
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
// Nice idea...but not today.
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/class-name-casing": "off",
"@typescript-eslint/explicit-function-return-type": "off",
Expand All @@ -81,6 +83,10 @@ module.exports = {
"@typescript-eslint/no-triple-slash-reference": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "ignoreRestSiblings": true }],
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-empty-function": "off",
// It"s all very well saying that some types are trivially inferrable,
// but being explicit is still clearer.
"@typescript-eslint/no-inferrable-types": "off",
},
env: {
jest: true
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
"@types/resize-observer-browser": "^0.1.1",
"@types/tabbable": "^3.1.0",
"@types/uuid": "^3.4.4",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"autoprefixer": "^7.1.5",
"axe-core": "^3.3.2",
"axe-puppeteer": "^1.0.0",
Expand Down Expand Up @@ -128,19 +128,19 @@
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-to-json": "^3.3.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.2.0",
"eslint-import-resolver-webpack": "^0.11.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-import-resolver-webpack": "^0.12.1",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-jest": "^22.5.1",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-local": "^1.0.0",
"eslint-plugin-mocha": "^5.3.0",
"eslint-plugin-mocha": "^6.3.0",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-react": "^7.13.0",
"eslint-plugin-react-hooks": "^2.0.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^3.0.0",
"faker": "^4.1.0",
"file-loader": "^1.1.11",
"findup": "^0.1.5",
Expand Down
4 changes: 2 additions & 2 deletions src/components/color_picker/color_stops/color_stops.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function getValidStops(colorStops: ColorStop[]) {
function getRangeMin(colorStops: ColorStop[], min?: number) {
const rangeMin = min || DEFAULT_MIN;
const stops = getValidStops(colorStops);
const first = Math.min.apply(Math, stops); // https://johnresig.com/blog/fast-javascript-maxmin/
const first = Math.min(...stops); // https://johnresig.com/blog/fast-javascript-maxmin/

if (first < rangeMin) {
if (stops.length === 1) {
Expand All @@ -91,7 +91,7 @@ function getRangeMin(colorStops: ColorStop[], min?: number) {
function getRangeMax(colorStops: ColorStop[], max?: number) {
const rangeMax = max || DEFAULT_MAX;
const stops = getValidStops(colorStops);
const last = Math.max.apply(Math, stops); // https://johnresig.com/blog/fast-javascript-maxmin/
const last = Math.max(...stops); // https://johnresig.com/blog/fast-javascript-maxmin/

if (last > rangeMax) {
if (stops.length === 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/datagrid/data_grid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ expect.extend({
},
});
declare global {
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable-next-line @typescript-eslint/no-namespace,no-redeclare */
namespace jest {
interface Matchers<R> {
toBeEuiPopover(): R;
Expand Down
1 change: 1 addition & 0 deletions src/components/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/triple-slash-reference */
/// <reference path="./date_picker/index.d.ts" />

declare module '@elastic/eui' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ describe('testResizeObservers', () => {
HTMLElement.prototype.getBoundingClientRect;
HTMLElement.prototype.getBoundingClientRect = function() {
// use the length of the element's HTML to represent its height
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
return { width: 100, height: this.innerHTML.length } as ReturnType<
GetBoundingClientRect
>;
Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/* eslint-disable @typescript-eslint/triple-slash-reference */
/// <reference path="./components/index.d.ts" />
/// <reference path="./themes/index.d.ts" />
Loading

0 comments on commit b2a2212

Please sign in to comment.