feat: add prettier lint scripts and workflow (#3546)

* feat: add lint scripts and workflow

Signed-off-by: kushthedude <kushthedude@gmail.com>

* fix lint

Signed-off-by: kushthedude <kushthedude@gmail.com>
This commit is contained in:
Kush Trivedi 2021-02-04 20:07:03 +05:30 committed by GitHub
parent 54f438721e
commit 6750a45d53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 9 deletions

View File

@ -130,6 +130,11 @@ jobs:
npm i -g yarn npm i -g yarn
yarn install yarn install
- name: Lint with Prettier
run: |
cd ./main/tests/cypress
yarn check-lint
- name: Test with Cypress on ${{ matrix.browser }} - name: Test with Cypress on ${{ matrix.browser }}
run: | run: |
echo REFINE_MIN_MEMORY=1400M >> ./refine.ini echo REFINE_MIN_MEMORY=1400M >> ./refine.ini

View File

@ -33,7 +33,7 @@ describe(__filename, function () {
it('Perform a number sort + Reverse + Remove', function () { it('Perform a number sort + Reverse + Remove', function () {
cy.loadAndVisitProject('food.sort') cy.loadAndVisitProject('food.sort')
cy.castColumnTo('NDB_No','number') cy.castColumnTo('NDB_No', 'number')
cy.columnActionClick('NDB_No', ['Sort']) cy.columnActionClick('NDB_No', ['Sort'])
cy.waitForDialogPanel() cy.waitForDialogPanel()
@ -54,7 +54,7 @@ describe(__filename, function () {
it('Perform a date sort + Reverse + Remove', function () { it('Perform a date sort + Reverse + Remove', function () {
cy.loadAndVisitProject('food.sort') cy.loadAndVisitProject('food.sort')
cy.castColumnTo('Date','date') cy.castColumnTo('Date', 'date')
cy.columnActionClick('Date', ['Sort']) cy.columnActionClick('Date', ['Sort'])
cy.waitForDialogPanel() cy.waitForDialogPanel()
@ -74,7 +74,6 @@ describe(__filename, function () {
cy.columnActionClick('Date', ['Sort', 'Remove sort']) cy.columnActionClick('Date', ['Sort', 'Remove sort'])
cy.getCell(0, 'Date').should('to.contain', '2020-12-17T00:00:00Z') cy.getCell(0, 'Date').should('to.contain', '2020-12-17T00:00:00Z')
cy.getCell(1, 'Date').should('to.contain', '2020-08-17T00:00:00Z') cy.getCell(1, 'Date').should('to.contain', '2020-08-17T00:00:00Z')
}) })
it('Perform a bool sort + Reverse + Remove', function () { it('Perform a bool sort + Reverse + Remove', function () {
cy.loadAndVisitProject('food.sort') cy.loadAndVisitProject('food.sort')

View File

@ -31,7 +31,7 @@ describe(__filename, function () {
it('Ensure it reverses and reorders number sort', function () { it('Ensure it reverses and reorders number sort', function () {
cy.loadAndVisitProject('food.sort') cy.loadAndVisitProject('food.sort')
cy.castColumnTo('NDB_No','number') cy.castColumnTo('NDB_No', 'number')
cy.columnActionClick('NDB_No', ['Sort']) cy.columnActionClick('NDB_No', ['Sort'])
cy.waitForDialogPanel() cy.waitForDialogPanel()
@ -56,7 +56,7 @@ describe(__filename, function () {
it('Ensure it reverses and reorders date sort', function () { it('Ensure it reverses and reorders date sort', function () {
cy.loadAndVisitProject('food.sort') cy.loadAndVisitProject('food.sort')
cy.castColumnTo('Date','date') cy.castColumnTo('Date', 'date')
cy.columnActionClick('Date', ['Sort']) cy.columnActionClick('Date', ['Sort'])
cy.waitForDialogPanel() cy.waitForDialogPanel()

View File

@ -69,7 +69,24 @@ Cypress.Commands.add('loadProject', (fixture, projectName, tagName) => {
// the following code can be used to inject tags in created projects // the following code can be used to inject tags in created projects
// It's conflicting though, breaking up the CSV files // It's conflicting though, breaking up the CSV files
// It is a hack to parse out CSV files in the openrefine while creating a project with tags // It is a hack to parse out CSV files in the openrefine while creating a project with tags
const options = {"encoding":"US-ASCII","separator":",","ignoreLines":-1,"headerLines":1,"skipDataLines":0,"limit":-1,"storeBlankRows":true,"guessCellValueTypes":false,"processQuotes":true,"quoteCharacter":"\"","storeBlankCellsAsNulls":true,"includeFileSources":false,"includeArchiveFileName":false,"trimStrings":false,"projectName":openRefineProjectName,"projectTags": [tagName]} const options = {
encoding: 'US-ASCII',
separator: ',',
ignoreLines: -1,
headerLines: 1,
skipDataLines: 0,
limit: -1,
storeBlankRows: true,
guessCellValueTypes: false,
processQuotes: true,
quoteCharacter: '"',
storeBlankCellsAsNulls: true,
includeFileSources: false,
includeArchiveFileName: false,
trimStrings: false,
projectName: openRefineProjectName,
projectTags: [tagName],
}
var postData var postData
if (tagName == undefined) { if (tagName == undefined) {
postData = postData =

View File

@ -5,6 +5,11 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"author": "OpenRefine", "author": "OpenRefine",
"private": true, "private": true,
"scripts": {
"test": "cypress run --browser electron --headless --quiet",
"lint": "prettier --write .",
"check-lint": "prettier --check ."
},
"dependencies": { "dependencies": {
"cypress": "6.2.1", "cypress": "6.2.1",
"cypress-file-upload": "^5.0.2", "cypress-file-upload": "^5.0.2",