-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use TypeScript, first implementation #69
base: master
Are you sure you want to change the base?
Conversation
package.json
Outdated
"prepare": "npm run clean && npm run build", | ||
"test": "npm run build && npm run test-unit && npm run lint", | ||
"test-unit": "mocha build/test --recursive --require ./build/test/setup", | ||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем jsx и tsx тут?
в проекте не будет же UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
давайте добавим prettifier. потом добавить будет больнее
src/index.ts
Outdated
import _ from 'lodash'; | ||
import parseColor from 'parse-color'; | ||
import colorDiff from 'color-diff'; | ||
import * as png from './lib/png'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вроде нет смысла делать import * as
для файлов этого же пакета
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не понял. Почему не имеет смысла?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мне не нравится такая запись import * as
. поэтому я бы предпочёл её избегать в меру сил и возможностей.
мб я один такой :)
src/lib/diff-area.ts
Outdated
@@ -1,6 +1,7 @@ | |||
'use strict'; | |||
export = class DiffArea { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
давай сразу оторвём все export =
и export default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не понял зачем везде исправлять export default
? Я наоборот всегда его юзаю если предполагается, что модуль будет экспортить только один класс/функцию/...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я не то чтобы сильно настаиваю, что это нужно делать при переписывании на TS прямо сейчас.
в статье представлены убедительные аргументы, кмк:
https://medium.com/devschacht/%D0%BF%D0%BE%D1%87%D0%B5%D0%BC%D1%83-%D1%8F-%D0%BF%D0%B5%D1%80%D0%B5%D1%81%D1%82%D0%B0%D0%BB-%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D1%8C-%D1%8D%D0%BA%D1%81%D0%BF%D0%BE%D1%80%D1%82-%D0%BF%D0%BE-%D1%83%D0%BC%D0%BE%D0%BB%D1%87%D0%B0%D0%BD%D0%B8%D1%8E-%D0%B2-%D0%BC%D0%BE%D0%B8%D1%85-javascript-%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D1%8F%D1%85-d03e63bed126
src/lib/diff-area.ts
Outdated
@@ -1,6 +1,7 @@ | |||
'use strict'; | |||
export = class DiffArea { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не понял зачем везде исправлять export default
? Я наоборот всегда его юзаю если предполагается, что модуль будет экспортить только один класс/функцию/...
/fixed |
}, | ||
"homepage": "https://github.com/gemini-testing/looks-same" | ||
"name": "looks-same", | ||
"version": "7.2.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
версия даунгрейднулась
"chai-as-promised": "^7.1.1", | ||
"copy": "^0.3.2", | ||
"eslint": "^6.8.0", | ||
"eslint-config-gemini-testing": "^2.8.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint-config-gemini-testing можно удалить, если не пользуемся
* It is created specially for the needs of visual regression testing for gemini utility, but can be used for other purposes. | ||
*/ | ||
export = looksSame; | ||
// Type definitions for looks-same 5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а почему это отдельный файл .d.ts, а не просто ts код?
@@ -0,0 +1,87 @@ | |||
"use strict"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use strict не нужен
@@ -21,8 +19,8 @@ const validateBoundingBoxCoords = ({boundingBox}) => { | |||
} | |||
}; | |||
|
|||
exports.validateImages = (img1, img2) => { | |||
[img1, img2].forEach((i) => { | |||
export const validateImages = (img1, img2) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
предпочёл бы export function validateImage ...
ping |
What is done: