Skip to content

eslint on src and src/__tests__ #638

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

Merged
merged 5 commits into from
Aug 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
27 changes: 27 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"root": true,
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true
},
"parser": "babel-eslint",
"plugins": [
"flowtype"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"no-trailing-spaces": 2,
"eol-last": 2,
"space-in-parens": ["error", "never"],
"no-multiple-empty-lines": 1,
"prefer-const": "error",
"space-infix-ops": "error",
"no-useless-escape": "off"
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ integration/test_logs
test_logs
out/
docs/
.eslintcache

1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- npm install -g mongodb-runner
- mongodb-runner start
script:
- npm run lint
- npm test -- --maxWorkers=4
- npm run integration
after_script: ./node_modules/codecov/bin/codecov -f ./coverage/coverage-final.json && rm -rf ./coverage
Expand Down
18 changes: 9 additions & 9 deletions 2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ With native promises, `.done` and `.fail` don't exist and are replaces by `.then
// before
const query = new Parse.Query();
query.find()
.done((results) => {
.done((results) => {

})
.fail((error) => {
.fail((error) => {

});

// after
query.find()
.then((results) => {
.then((results) => {

})
.catch((error) => {
.catch((error) => {

});
```
Expand All @@ -37,13 +37,13 @@ query.find()
// before
const query = new Parse.Query();
query.find()
.always((result) => {
.always((result) => {

});

// after
query.find()
.finally((result) => {
.finally((result) => {

});
```
Expand All @@ -55,15 +55,15 @@ With native promises, the constructor is different, you will need to update to t
```js
// before
const promise = new Promise();
doSomethingAsync((error, success) => {
doSomethingAsync((error, success) => {
if (error) { promise.reject(error); }
else { promise.resolve(success); }
});
return promise;

// after
return new Promise((resolve, reject) => {
doSomethingAsync((error, success) => {
return new Promise((resolve, reject) => {
doSomethingAsync((error, success) => {
if (error) { reject(error); }
else { resolve(success); }
});
Expand Down
3 changes: 2 additions & 1 deletion integration/cloud/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global Parse */
Parse.Cloud.define("bar", function(request, response) {
if (request.params.key2 === "value1") {
response.success('Foo');
Expand All @@ -22,4 +23,4 @@ Parse.Cloud.job('CloudJob2', function(request, response) {

Parse.Cloud.job('CloudJobFailing', function(request, response) {
response.error('cloud job failed');
});
});
10 changes: 10 additions & 0 deletions integration/test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"env": {
"jasmine": true
},
"globals": {},
"rules": {
"no-console": [0],
"no-var": "error"
}
}
Loading