diff --git a/.eslintrc.js b/.eslintrc.js index 973bf18e97..c72f6fa9b4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -55,7 +55,6 @@ module.exports = { 'import/no-unresolved': 'error', 'no-irregular-whitespace': 'error', 'no-unused-expressions': 'error', - quotemark: [true, 'single', 'jsx-double'], '@typescript-eslint/interface-name-prefix': 'off', '@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }], '@typescript-eslint/no-explicit-any': 'off', diff --git a/.huskyrc.js b/.huskyrc.js new file mode 100644 index 0000000000..1ae7d74b8b --- /dev/null +++ b/.huskyrc.js @@ -0,0 +1,14 @@ +const tasks = (arr) => arr.join(' && '); + +module.exports = { + hooks: { + 'pre-commit': tasks([ + 'pretty-quick --staged', + 'yarn run typecheck:all', + 'yarn run lint', + 'yarn run test', + 'yarn run test:tz', + ]), + 'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS', + }, +}; diff --git a/package.json b/package.json index 18681e3d0e..a95a323511 100644 --- a/package.json +++ b/package.json @@ -37,31 +37,26 @@ "typecheck:all": "tsc -p ./tsconfig.json --noEmit", "playground": "cd .playground && webpack-dev-server", "playground:ie": "cd .playground && webpack-dev-server --host=0.0.0.0 --disable-host-check --useLocalIp", - "jest:integration": "TZ=UTC JEST_PUPPETEER_CONFIG=integration/jest-puppeteer.config.js jest --verbose --rootDir=integration -c=integration/jest.config.js --runInBand" + "jest:integration": "TZ=UTC JEST_PUPPETEER_CONFIG=integration/jest-puppeteer.config.js jest --verbose --rootDir=integration -c=integration/jest.config.js --runInBand", + "ts:prune": "ts-prune" }, "files": [ "dist/**/*", "FAQ.md", "yarn.lock" ], - "husky": { - "hooks": { - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS", - "pre-commit": "pretty-quick --staged && yarn run typecheck:all && yarn run lint && yarn run test && yarn run test:tz" - } - }, "devDependencies": { - "@babel/core": "^7.3.4", - "@babel/polyfill": "^7.4.4", + "@babel/core": "^7.7.4", + "@babel/polyfill": "^7.7.0", "@commitlint/cli": "^8.1.0", "@commitlint/config-conventional": "^8.1.0", - "@elastic/eui": "^13.1.0", - "@semantic-release/changelog": "^3.0.4", - "@semantic-release/commit-analyzer": "^6.2.0", - "@semantic-release/git": "^7.0.16", - "@semantic-release/github": "^5.4.2", - "@semantic-release/npm": "^5.1.13", - "@semantic-release/release-notes-generator": "^7.2.1", + "@elastic/eui": "^16.0.1", + "@semantic-release/changelog": "^3.0.6", + "@semantic-release/commit-analyzer": "^6.3.3", + "@semantic-release/git": "^7.0.18", + "@semantic-release/github": "^5.5.5", + "@semantic-release/npm": "^5.3.4", + "@semantic-release/release-notes-generator": "^7.3.4", "@storybook/addon-actions": "5.1.9", "@storybook/addon-info": "5.1.9", "@storybook/addon-knobs": "5.1.9", @@ -91,8 +86,8 @@ "@types/storybook__react": "^4.0.2", "@types/url-parse": "^1.4.3", "@types/uuid": "^3.4.4", - "@typescript-eslint/eslint-plugin": "^2.3.2", - "@typescript-eslint/parser": "^2.3.2", + "@typescript-eslint/eslint-plugin": "^2.9.0", + "@typescript-eslint/parser": "^2.9.0", "autoprefixer": "^9.6.1", "babel-loader": "^8.0.5", "canvas": "^2.4.1", @@ -102,13 +97,13 @@ "d3-random": "^1.1.2", "enzyme": "^3.9.0", "enzyme-adapter-react-16": "^1.10.0", - "eslint": "^5.16.0", - "eslint-config-prettier": "^4.3.0", + "eslint": "^6.7.1", + "eslint-config-prettier": "^6.7.0", "eslint-plugin-import": "^2.17.3", - "eslint-plugin-jest": "^22.6.4", + "eslint-plugin-jest": "^23.0.4", "eslint-plugin-prettier": "^3.1.0", "eslint-plugin-react": "^7.13.0", - "husky": "^1.3.1", + "husky": "^3.1.0", "jest": "^24.9.0", "jest-environment-jsdom-fourteen": "^0.1.0", "jest-extended": "^0.11.2", @@ -131,11 +126,12 @@ "sass-graph": "^3.0.4", "sass-loader": "^7.1.0", "seedrandom": "^3.0.5", - "semantic-release": "^15.13.19", - "semantic-release-slack-bot": "^1.2.0", + "semantic-release": "^15.13.31", + "semantic-release-slack-bot": "^1.3.5", "style-loader": "^0.23.1", "ts-jest": "^24.1.0", "ts-loader": "^6.1.2", + "ts-prune": "^0.3.0", "typescript": "^3.6.3", "utility-types": "^3.8.0", "webpack": "^4.29.5", diff --git a/src/chart_types/xy_chart/utils/fit_function.test.ts b/src/chart_types/xy_chart/utils/fit_function.test.ts index 2cd40e95a8..7701d5950b 100644 --- a/src/chart_types/xy_chart/utils/fit_function.test.ts +++ b/src/chart_types/xy_chart/utils/fit_function.test.ts @@ -173,7 +173,7 @@ describe('Fit Function', () => { }); }); - describe("endValue is set to 'nearest'", () => { + describe(`endValue is set to 'nearest'`, () => { it('should return current datum with value from next when previous is null', () => { const current = MockDataSeriesDatum.simple({ x: 3 }); const next = MockDataSeriesDatum.full({ x: 4, y1: 20 }); diff --git a/src/utils/data/formatters.tz.test.ts b/src/utils/data/formatters.tz.test.ts index 3133ec1881..b5dd5200c9 100644 --- a/src/utils/data/formatters.tz.test.ts +++ b/src/utils/data/formatters.tz.test.ts @@ -19,7 +19,7 @@ describe('Date Formatter', () => { expect(formatter(END_DAY + aDay, TIMEZONE_UTC)).toBe('2019-01-02'); expect(formatter(END_DAY + aDay * 2, TIMEZONE_UTC)).toBe('2019-01-03'); }); - test(`America/New_York`, () => { + test('America/New_York', () => { expect(formatter(START_DAY, TIMEZONE_NY)).toBe('2018-12-31'); expect(formatter(START_DAY + aDay, TIMEZONE_NY)).toBe('2019-01-01'); expect(formatter(START_DAY + aDay * 2, TIMEZONE_NY)).toBe('2019-01-02'); @@ -27,7 +27,7 @@ describe('Date Formatter', () => { expect(formatter(END_DAY + aDay, TIMEZONE_NY)).toBe('2019-01-02'); expect(formatter(END_DAY + aDay * 2, TIMEZONE_NY)).toBe('2019-01-03'); }); - test(`Asia/Tokyo`, () => { + test('Asia/Tokyo', () => { expect(formatter(START_DAY, TIMEZONE_TOKYO)).toBe('2019-01-01'); expect(formatter(START_DAY + aDay, TIMEZONE_TOKYO)).toBe('2019-01-02'); expect(formatter(START_DAY + aDay * 2, TIMEZONE_TOKYO)).toBe('2019-01-03'); @@ -46,7 +46,7 @@ describe('Date Formatter', () => { expect(formatter(END_DAY + aDay, TIMEZONE_UTC)).toBe('January 02'); expect(formatter(END_DAY + aDay * 2, TIMEZONE_UTC)).toBe('January 03'); }); - test(`America/New_York`, () => { + test('America/New_York', () => { expect(formatter(START_DAY, TIMEZONE_NY)).toBe('December 31'); expect(formatter(START_DAY + aDay, TIMEZONE_NY)).toBe('January 01'); expect(formatter(START_DAY + aDay * 2, TIMEZONE_NY)).toBe('January 02'); @@ -54,7 +54,7 @@ describe('Date Formatter', () => { expect(formatter(END_DAY + aDay, TIMEZONE_NY)).toBe('January 02'); expect(formatter(END_DAY + aDay * 2, TIMEZONE_NY)).toBe('January 03'); }); - test(`Asia/Tokyo`, () => { + test('Asia/Tokyo', () => { expect(formatter(START_DAY, TIMEZONE_TOKYO)).toBe('January 01'); expect(formatter(START_DAY + aDay, TIMEZONE_TOKYO)).toBe('January 02'); expect(formatter(START_DAY + aDay * 2, TIMEZONE_TOKYO)).toBe('January 03'); @@ -73,7 +73,7 @@ describe('Date Formatter', () => { expect(formatter(END_DAY + aDay, TIMEZONE_UTC)).toBe('01-02 23:59'); expect(formatter(END_DAY + aDay * 2, TIMEZONE_UTC)).toBe('01-03 23:59'); }); - test(`America/New_York`, () => { + test('America/New_York', () => { expect(formatter(START_DAY, TIMEZONE_NY)).toBe('12-31 19:00'); expect(formatter(START_DAY + aDay, TIMEZONE_NY)).toBe('01-01 19:00'); expect(formatter(START_DAY + aDay * 2, TIMEZONE_NY)).toBe('01-02 19:00'); @@ -81,7 +81,7 @@ describe('Date Formatter', () => { expect(formatter(END_DAY + aDay, TIMEZONE_NY)).toBe('01-02 18:59'); expect(formatter(END_DAY + aDay * 2, TIMEZONE_NY)).toBe('01-03 18:59'); }); - test(`Asia/Tokyo`, () => { + test('Asia/Tokyo', () => { expect(formatter(START_DAY, TIMEZONE_TOKYO)).toBe('01-01 09:00'); expect(formatter(START_DAY + aDay, TIMEZONE_TOKYO)).toBe('01-02 09:00'); expect(formatter(START_DAY + aDay * 2, TIMEZONE_TOKYO)).toBe('01-03 09:00'); @@ -100,7 +100,7 @@ describe('Date Formatter', () => { expect(formatter(END_DAY + anHour * 2.5, TIMEZONE_UTC)).toBe('02:29:59'); expect(formatter(END_DAY + anHour * 10.5 + 1000, TIMEZONE_UTC)).toBe('10:30:00'); }); - test(`America/New_York`, () => { + test('America/New_York', () => { expect(formatter(START_DAY, TIMEZONE_NY)).toBe('19:00:00'); expect(formatter(START_DAY + anHour * 2.5, TIMEZONE_NY)).toBe('21:30:00'); expect(formatter(START_DAY + anHour * 10.5 + 1000, TIMEZONE_NY)).toBe('05:30:01'); @@ -108,7 +108,7 @@ describe('Date Formatter', () => { expect(formatter(END_DAY + anHour * 2.5, TIMEZONE_NY)).toBe('21:29:59'); expect(formatter(END_DAY + anHour * 10.5 + 1000, TIMEZONE_NY)).toBe('05:30:00'); }); - test(`Asia/Tokyo`, () => { + test('Asia/Tokyo', () => { expect(formatter(START_DAY, TIMEZONE_TOKYO)).toBe('09:00:00'); expect(formatter(START_DAY + anHour * 2.5, TIMEZONE_TOKYO)).toBe('11:30:00'); expect(formatter(START_DAY + anHour * 10.5 + 1000, TIMEZONE_TOKYO)).toBe('19:30:01'); diff --git a/stories/styling.tsx b/stories/styling.tsx index d1c8925cb5..d176d5ae50 100644 --- a/stories/styling.tsx +++ b/stories/styling.tsx @@ -840,7 +840,7 @@ storiesOf('Stylings', module)