Skip to content
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

ci: refactor lint CI task and fix lint issues #2004

Merged
merged 32 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e08ed25
chore(vscode): add Jest types
RaschidJFR Jan 18, 2022
15db771
style(*): fix lint errors
RaschidJFR Jan 18, 2022
bcebbb8
test(*): update failing tests
RaschidJFR Jan 18, 2022
286b6c7
chore(workflows): add step `check-jest`
RaschidJFR Jan 18, 2022
9a41ea2
Merge branch 'alpha' into bugfix/fix_lint_and_tests
RaschidJFR Jan 20, 2022
174ea3e
ci: bump environment
mtrezza Feb 8, 2022
fdf5eb2
bump node
mtrezza Feb 9, 2022
7bfdad4
ci: bump environment (#2034)
mtrezza Feb 9, 2022
f80bd07
fix: adding internal class (e.g. `_User`) fails due to prefixed under…
KodeDave Feb 10, 2022
13b1759
chore(release): 4.0.0-alpha.16 [skip ci]
semantic-release-bot Feb 10, 2022
1798179
refactor: bump follow-redirects from 1.14.7 to 1.14.8 (#2039)
dependabot[bot] Feb 12, 2022
a0720a6
refactor: upgrade typescript from 4.5.4 to 4.5.5 (#2038)
snyk-bot Feb 12, 2022
9ddc98d
refactor: bump node-sass from 6.0.1 to 7.0.0 (#2037)
dependabot[bot] Feb 12, 2022
3a3e5e7
refactor: upgrade otpauth from 7.0.9 to 7.0.10 (#2044)
snyk-bot Feb 17, 2022
57c4870
refactor: upgrade graphql from 16.2.0 to 16.3.0 (#2043)
snyk-bot Feb 17, 2022
67e8cfc
ci: run unit tests in 'check-build'; readd 'check-lint'
RaschidJFR Feb 19, 2022
2cd948a
chore(jest): configure to map '.css' and avoid failing
RaschidJFR Feb 19, 2022
bea131d
Merge branch 'alpha' into bugfix/fix_lint_and_tests
RaschidJFR Feb 22, 2022
3afb24e
fix: security upgrade prismjs from 1.26.0 to 1.27.0 (#2047)
snyk-bot Feb 23, 2022
cb70cba
chore(release): 4.0.0-alpha.17 [skip ci]
semantic-release-bot Feb 23, 2022
0e819c6
refactor: upgrade @babel/runtime from 7.16.7 to 7.17.0 (#2048)
snyk-bot Feb 24, 2022
93335e9
fix: upgrade @babel/runtime from 7.17.0 to 7.17.2 (#2055)
snyk-bot Mar 2, 2022
23ed93d
chore(release): 4.0.0-alpha.18 [skip ci]
semantic-release-bot Mar 2, 2022
a6f7a3b
refactor: upgrade body-parser from 1.19.1 to 1.19.2 (#2057)
snyk-bot Mar 10, 2022
f8dc602
fix: upgrade express from 4.17.2 to 4.17.3 (#2058)
snyk-bot Mar 10, 2022
c55d3d1
chore(release): 4.0.0-alpha.19 [skip ci]
semantic-release-bot Mar 10, 2022
c2b1f09
test(parse-sdk): add e2e test case for loading sdk
RaschidJFR Mar 11, 2022
77820c0
test(jest): run with flag `--unhandled-rejections`
RaschidJFR Mar 11, 2022
7b4e89b
Merge branch 'alpha' into bugfix/fix_lint_and_tests
mtrezza Mar 12, 2022
2fee2e9
test(*): mock module 'idb-keyval' to support tests in Node v16
RaschidJFR Mar 16, 2022
2961719
test(jest): mock module 'idb-keyval' locally instead of globally
RaschidJFR Mar 16, 2022
07bbf30
Merge branch 'alpha' into bugfix/fix_lint_and_tests
mtrezza Mar 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ jobs:
run: npm ci
- name: CI Node Engine Check
run: npm run ci:checkNodeEngine
# check-lint:
# name: Lint
# timeout-minutes: 15
# runs-on: ubuntu-18.04
# steps:
# - uses: actions/checkout@v2
# - name: Use Node.js ${{ env.NODE_VERSION }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ env.node-version }}
# - name: Cache Node.js modules
# uses: actions/cache@v2
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-${{ env.NODE_VERSION }}-
# - name: Install dependencies
# run: npm ci
# - run: npm run lint
check-lint:
name: Lint
timeout-minutes: 15
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.node-version }}
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-
- name: Install dependencies
run: npm ci
- run: npm run lint
check-circular:
name: Circular Dependencies
timeout-minutes: 5
Expand Down Expand Up @@ -147,6 +147,8 @@ jobs:
- name: Install dependencies (Node >= 10)
run: npm ci
if: ${{ steps.node.outputs.node_major >= 10 }}
- name: Tests
run: npm test
- name: Test bundles
run: ./scripts/before_script.sh
env:
Expand Down
8 changes: 8 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"typeAcquisition": {
"include": [
"jest"
]
},
"exclude": ["node_modules"]
}
92 changes: 91 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "parse-dashboard",
"version": "4.1.0-beta.1",
"version": "4.0.0-alpha.19",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-dashboard"
Expand Down Expand Up @@ -89,6 +89,7 @@
"@semantic-release/github": "7.2.3",
"@semantic-release/npm": "7.1.3",
"@semantic-release/release-notes-generator": "9.0.3",
"@types/jest": "27.4.0",
"all-node-versions": "8.0.0",
"babel-eslint": "10.1.0",
"babel-loader": "8.2.3",
Expand Down Expand Up @@ -127,7 +128,6 @@
"build": "webpack --node-env=production --config webpack/production.config.js && webpack --config webpack/PIG.config.js",
"test": "jest",
"lint": "eslint . --ignore-path .gitignore --cache",
"pretest": "npm run lint",
"generate": "node scripts/generate.js",
"prepare": "webpack --config webpack/publish.config.js --progress",
"start": "node ./Parse-Dashboard/index.js",
Expand All @@ -148,6 +148,9 @@
"transform": {
".*": "<rootDir>/testing/preprocessor.js"
},
"moduleNameMapper": {
"\\.(css|less)$": "<rootDir>/testing/styleMock.js"
},
"unmockedModulePathPatterns": [
"react",
"react-dom",
Expand Down
4 changes: 2 additions & 2 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function config() {
// Get branch
const branch = ref.split('/').pop();
console.log(`Running on branch: ${branch}`);

// Set changelog file
const changelogFile = `./changelogs/CHANGELOG_${branch}.md`;
console.log(`Changelog file output to: ${changelogFile}`);
Expand Down Expand Up @@ -96,7 +96,7 @@ async function config() {
['@semantic-release/github', {
successComment: getReleaseComment(),
labels: ['type:ci'],
releasedLabels: ['state:released<%= nextRelease.channel ? `-\${nextRelease.channel}` : "" %>']
mtrezza marked this conversation as resolved.
Show resolved Hide resolved
releasedLabels: ['state:released<%= nextRelease.channel ? `-${nextRelease.channel}` : "" %>']
}],
],
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/Markdown/Markdown.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* the root directory of this source tree.
*/
import CodeSnippet from 'components/CodeSnippet/CodeSnippet.react';
import marked from 'marked';
import { marked } from 'marked';
import PropTypes from 'lib/PropTypes';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
Expand Down
4 changes: 2 additions & 2 deletions src/components/Pill/Pill.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
*/
import React from 'react';
import styles from 'components/Pill/Pill.scss';
import Icon from "components/Icon/Icon.react";
import Icon from 'components/Icon/Icon.react';

//TODO: refactor, may want to move onClick outside or need to make onClick able to handle link/button a11y
let Pill = ({ value, onClick, fileDownloadLink, followClick = false, shrinkablePill = false }) => (
<span
className={[
styles.pill,
!followClick && onClick ? styles.action : void 0
].join(" ")}
].join(' ')}
onClick={!followClick && onClick ? onClick : null}
>
<span className={!followClick && fileDownloadLink ? styles.content : shrinkablePill ? styles.pillText : ''}>{value}</span>
Expand Down
2 changes: 0 additions & 2 deletions src/components/PushPreview/PushPreview.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
import PropTypes from 'lib/PropTypes';
import ParseApp from 'lib/ParseApp';
import React from 'react';
import SegmentSelect from 'components/SegmentSelect/SegmentSelect.react';
import styles from 'components/PushPreview/PushPreview.scss';
Expand Down
6 changes: 3 additions & 3 deletions src/components/Sidebar/Pin.react.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import React from 'react';

import Icon from "components/Icon/Icon.react";
import styles from "components/Sidebar/Sidebar.scss";
import Icon from 'components/Icon/Icon.react';
import styles from 'components/Sidebar/Sidebar.scss';

const Pin = ({ onClick }) => (
<div className={styles.pinContainer} onClick={onClick}>
Expand Down
10 changes: 5 additions & 5 deletions src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class Browser extends DashboardView {
if (name === 'objectId' || this.state.isUnique && name !== this.state.uniqueField) {
return;
}
if (!!required) {
if (required) {
requiredCols.push(name);
}
if (className === '_User' && (name === 'username' || name === 'password')) {
Expand All @@ -419,7 +419,7 @@ class Browser extends DashboardView {
for (let idx = 0; idx < requiredCols.length; idx++) {
const name = requiredCols[idx];
if (obj.get(name) == null) {
this.showNote("Please enter all required fields", true);
this.showNote('Please enter all required fields', true);
this.setState({
markRequiredFieldRow: -1
});
Expand Down Expand Up @@ -461,7 +461,7 @@ class Browser extends DashboardView {
if (msg) {
msg = msg[0].toUpperCase() + msg.substr(1);
}
obj.set(attr, prev);
obj.revert();
this.setState({ data: this.state.data });
this.showNote(msg, true);
}
Expand Down Expand Up @@ -506,7 +506,7 @@ class Browser extends DashboardView {
if (name === 'objectId' || this.state.isUnique && name !== this.state.uniqueField) {
return;
}
if (!!required) {
mtrezza marked this conversation as resolved.
Show resolved Hide resolved
if (required) {
requiredCols.push(name);
}
if (className === '_User' && (name === 'username' || name === 'password')) {
Expand All @@ -523,7 +523,7 @@ class Browser extends DashboardView {
for (let idx = 0; idx < requiredCols.length; idx++) {
const name = requiredCols[idx];
if (obj.get(name) == null) {
this.showNote("Please enter all required fields", true);
this.showNote('Please enter all required fields', true);
this.setState({
markRequiredFieldRow: rowIndex
});
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/Data/Browser/BrowserToolbar.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ let BrowserToolbar = ({
{editCloneRows && editCloneRows.length > 0 && (
<BrowserMenu title="Clone" icon="clone-icon">
<MenuItem
text={"Cancel all pending rows"}
text={'Cancel all pending rows'}
onClick={onCancelPendingEditRows}
/>
</BrowserMenu>
Expand Down
1 change: 1 addition & 0 deletions src/dashboard/Data/Browser/DataBrowser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ export default class DataBrowser extends React.Component {
getNextVisibleColumnIndex(distance = 1, min = 0, max = 0) {
if (distance === 0) { return this.state.current.col; }
let newIndex = this.state.current.col + distance;
// eslint-disable-next-line no-constant-condition
while (true) {
if (this.state.order[newIndex]?.visible) { return newIndex; }
if (newIndex <= min) { return min; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class ExportSelectedRowsDialog extends React.Component {
<Modal
type={Modal.Types.INFO}
icon='warn-outline'
title={this.props.selection['*'] ? 'Export all rows?' : (selectionLength === 1 ? `Export 1 selected row?` : `Export ${selectionLength} selected rows?`)}
title={this.props.selection['*'] ? 'Export all rows?' : (selectionLength === 1 ? 'Export 1 selected row?' : `Export ${selectionLength} selected rows?`)}
subtitle={this.props.selection['*'] ? 'Note: Exporting is limited to the first 10,000 rows.' : ''}
disabled={!this.valid()}
confirmText={'Yes export'}
Expand Down
1 change: 1 addition & 0 deletions src/lib/tests/BrowserCell.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* the root directory of this source tree.
*/
jest.dontMock('../../components/BrowserCell/BrowserCell.react');
jest.mock('idb-keyval');

import React from 'react';
import renderer from 'react-test-renderer';
Expand Down
Loading