Skip to content

Commit

Permalink
ci: refactor lint CI task and fix lint issues (parse-community#2004)
Browse files Browse the repository at this point in the history
  • Loading branch information
RaschidJFR authored and mtrezza committed Apr 3, 2022
1 parent 77f3350 commit 8709ea4
Show file tree
Hide file tree
Showing 17 changed files with 155 additions and 48 deletions.
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",
"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}` : "" %>']
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) {
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

0 comments on commit 8709ea4

Please sign in to comment.