Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Fixing ESLint GitHub test #5010

Merged
merged 36 commits into from Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1e845be
npm init @eslint/config
mojtaba-komeili Apr 17, 2023
4369e47
changed how we runt he lint
mojtaba-komeili Apr 17, 2023
cd3d542
nit bug
mojtaba-komeili Apr 17, 2023
9ac05e3
working directory
mojtaba-komeili Apr 17, 2023
63fc6b8
more nit
mojtaba-komeili Apr 17, 2023
5ca36e2
another try
mojtaba-komeili Apr 17, 2023
2706e74
back
mojtaba-komeili Apr 17, 2023
480e975
npm install
mojtaba-komeili Apr 17, 2023
4872db7
nit bug
mojtaba-komeili Apr 17, 2023
097b569
npm init @eslint/config
mojtaba-komeili Apr 17, 2023
2b5ee62
eslint global
mojtaba-komeili Apr 17, 2023
e934ae7
w
mojtaba-komeili Apr 17, 2023
037bc28
Another
mojtaba-komeili Apr 17, 2023
4ada26b
-y
mojtaba-komeili Apr 17, 2023
896d659
semistandard
mojtaba-komeili Apr 17, 2023
17cb0b6
--yes
mojtaba-komeili Apr 17, 2023
4fb6198
echo yes
mojtaba-komeili Apr 17, 2023
09c8f54
yes
mojtaba-komeili Apr 17, 2023
d21fc68
sielnt
mojtaba-komeili Apr 17, 2023
ce552ce
blah;
mojtaba-komeili Apr 17, 2023
1ff387c
npm init @eslint/config
mojtaba-komeili Apr 17, 2023
f0a1f6b
echo "yes "
mojtaba-komeili Apr 17, 2023
5ed9dd5
echo "yes "
mojtaba-komeili Apr 17, 2023
e5084a4
yes
mojtaba-komeili Apr 17, 2023
a05ac69
silent
mojtaba-komeili Apr 17, 2023
78ec5c5
no silent
mojtaba-komeili Apr 17, 2023
1710153
another time --yes
mojtaba-komeili Apr 17, 2023
0cc87c8
manual file install
mojtaba-komeili Apr 17, 2023
ea97527
manual file install
mojtaba-komeili Apr 17, 2023
f3ddc56
npm install --save-dev eslint
mojtaba-komeili Apr 17, 2023
3cde485
global
mojtaba-komeili Apr 17, 2023
76cd952
work dir
mojtaba-komeili Apr 17, 2023
4236983
minor fixes on JS lint
mojtaba-komeili Apr 17, 2023
cf50e83
run local
mojtaba-komeili Apr 17, 2023
dc8c9ea
only keep the current ones
mojtaba-komeili Apr 17, 2023
167f5ed
only diff
mojtaba-komeili Apr 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/lint.yml
Expand Up @@ -124,7 +124,12 @@ jobs:
run: |
set -eux
npm install
node_modules/.bin/eslint --format unix . | \
npm install --save-dev -g eslint
- name: Run ESLint
working-directory: parlai/crowdsourcing/
run: |
set -eux
npx eslint --format unix . | \
sed "s#${GITHUB_WORKSPACE}#.#" | \
tee ${GITHUB_WORKSPACE}/output-annotations.txt
- name: Add annotations
Expand Down
16 changes: 16 additions & 0 deletions parlai/crowdsourcing/.eslintrc.js
@@ -0,0 +1,16 @@
module.exports = {
env: {
browser: true,
node: true,
es2021: true
},
extends: ["eslint:recommended", "plugin:react/recommended"],
overrides: [],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module"
},
rules: {
"react/prop-types": 0
}
};
8 changes: 7 additions & 1 deletion parlai/crowdsourcing/package.json
Expand Up @@ -24,5 +24,11 @@
"prettier --write",
"git add"
]
}
},
"description": "Code for crowdsourcing tasks that use Mephisto. See the [Mephisto quick start guide](https://mephisto.ai/docs/guides/quickstart/) to quickly get started with Mephisto. **Please install Mephisto via poetry to avoid depdency conflits with ParlAI.** ``` # install poetry $ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python # from the root dir, install Mephisto: $ poetry install ``` This README provides a quick overview of how to run crowdsourcing tasks in ParlAI: see the [tutorial](https://github.com/facebookresearch/ParlAI/blob/main/docs/source/tutorial_crowdsourcing.md) for a deeper guide on how to set up and configure new crowdsourcing tasks.",
"version": "1.0.0",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC"
}
@@ -1,11 +1,11 @@
/*********************************************
* @ Jessica Huynh, Ting-Rui Chiang, Kyusong Lee
* Carnegie Mellon University 2022
*********************************************/
* @ Jessica Huynh, Ting-Rui Chiang, Kyusong Lee
* Carnegie Mellon University 2022
*********************************************/

import React from 'react';
import {Input, Form, Button} from 'antd';
import { SketchPicker } from 'react-color';
import React from "react";
import { Input, Form, Button } from "antd";
import { SketchPicker } from "react-color";

class ColorPicker extends React.Component {
/* Args:
Expand All @@ -15,7 +15,7 @@
{@String} previewText
*/

constructor (props) {
constructor(props) {
super(props);
this.state = {
visiblePicker: false,
Expand All @@ -25,43 +25,44 @@
}

handleClick = () => {
this.setState(
{ visiblePicker: !this.state.visiblePicker }
);
this.setState({ visiblePicker: !this.state.visiblePicker });
};

componentDidUpdate (prevProps) {
componentDidUpdate(prevProps) {
if (prevProps.initialValue !== this.props.initialValue) {
this.setState({color: this.props.initialValue});
this.setState({ color: this.props.initialValue });
}
}
close () {

close() {
this.setState({
visiblePicker: false,
visiblePicker: false
});
if (this.color !== undefined) {
if (this.color.hex === undefined){
if (this.color.hex === undefined) {
this.setState({
color: this.color
});
this.props.updateByKey(['style', 'global'], {"backgroundColor": this.color.toUpperCase()});
}
else{
this.props.updateByKey(["style", "global"], {
backgroundColor: this.color.toUpperCase()
});
} else {
this.setState({
color: this.color.hex
});
this.props.updateByKey(['style', 'global'], {"backgroundColor": this.color.hex.toUpperCase()});
this.props.updateByKey(["style", "global"], {
backgroundColor: this.color.hex.toUpperCase()
});
}
}
console.log(this.props)
};
console.log(this.props);
}

handleChange (e) {
handleChange(e) {
e.preventDefault();
this.setState({color: e.target.value});
this.setState({ color: e.target.value });
}

render() {
let colorStyle;
if (this.props.previewText === undefined) {
Expand All @@ -74,59 +75,78 @@
"border-color": "#BBBBBB"
};
} else {
colorStyle = {

Check failure on line 78 in parlai/crowdsourcing/tasks/dialcrowd/webapp-config/src/components/requesters/template/ColorPicker.js

View workflow job for this annotation

GitHub Actions / jslint

parlai/crowdsourcing/tasks/dialcrowd/webapp-config/src/components/requesters/template/ColorPicker.js#L78

[Error/no-unused-vars] 'colorStyle' is assigned a value but never used.
color: this.state.color,
color: this.state.color
};
}

return (<>
{this.showPicker()}
<div>
<div style={{display: 'inline-block', width: "20%"}}>
<Form.Item name={this.props.name}
rules={[{required: true, whitespace: true, message: "Please specify a color."}]}
onChange={(e) => this.handleChange(e)}
validateTrigger={['onChange', 'onBlur']}>
<Input placeholder="#000000"
style={{width: "1em", height: "1em", marginRight: "0.5em",
color: 'transparent', background: this.props.initialValue}}
onClick={this.handleClick}
/>
</Form.Item> </div>
</div>
</>);
return (
<>
{this.showPicker()}
<div>
<div style={{ display: "inline-block", width: "20%" }}>
<Form.Item
name={this.props.name}
rules={[
{
required: true,
whitespace: true,
message: "Please specify a color."
}
]}
onChange={e => this.handleChange(e)}
validateTrigger={["onChange", "onBlur"]}
>
<Input
placeholder="#000000"
style={{
width: "1em",
height: "1em",
marginRight: "0.5em",
color: "transparent",
background: this.props.initialValue
}}
onClick={this.handleClick}
/>
</Form.Item>{" "}
</div>
</div>
</>
);
}

handleColorChange (color, event) {
handleColorChange(color, event) {

Check failure on line 118 in parlai/crowdsourcing/tasks/dialcrowd/webapp-config/src/components/requesters/template/ColorPicker.js

View workflow job for this annotation

GitHub Actions / jslint

parlai/crowdsourcing/tasks/dialcrowd/webapp-config/src/components/requesters/template/ColorPicker.js#L118

[Error/no-unused-vars] 'event' is defined but never used.
this.color = color;
}
showPicker () {

showPicker() {
const popover = {
position: 'absolute',
zIndex: '2',
position: "absolute",
zIndex: "2"
};

const inner = {
left: 0,
bottom: 0,
position: 'absolute'
position: "absolute"
};

if (this.state.visiblePicker) {
return (<>
<div style={ popover }>
<div style={ inner }>
<SketchPicker
color={this.state.color}
onChangeComplete={(color) => this.handleColorChange(color)}
/>
<Button onClick={() => this.close()}
style={{width: "100%"}}>Done
</Button>
return (
<>
<div style={popover}>
<div style={inner}>
<SketchPicker
color={this.state.color}
onChangeComplete={color => this.handleColorChange(color)}
/>
<Button onClick={() => this.close()} style={{ width: "100%" }}>
Done
</Button>
</div>
</div>
</div>
</>);
</>
);
} else {
return null;
}
Expand Down