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

chore(all): [v16] Bump eslint and related packages, bump prettier and run on codebase #927

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
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

34 changes: 0 additions & 34 deletions .eslintrc

This file was deleted.

64 changes: 64 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const mocha = require("eslint-plugin-mocha");
const globals = require("globals");
const js = require("@eslint/js");

const {
FlatCompat,
} = require("@eslint/eslintrc");

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

module.exports = [{
ignores: [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved .eslintignore into this ignores property as required by eslint 9

// this needs to combine all other eslintignore files so that lint-staged knows what to ignore
"packages/cli/scaffold/*.js",
"packages/cli/src/generators/templates/**/*.template.js",
"**/.yarn",
"example-apps/onedrive/test/*",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I added this new ignore rule for onedrive example app tests; there seems to be some issue with eslint trying to read the .eslintrc.json in that root directory (?!) which I didn't want to get into...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes, yeah that seems reasonable!


],
}, ...compat.extends("eslint:recommended", "standard", "prettier"), {
plugins: {
mocha,
},

languageOptions: {
globals: {
...globals.node,
},
},
}, {
files: [
"packages/*/test/**/*.js",
"packages/*/smoke-test/**/*.js",
"packages/*/integration-test/**/*.js",
"packages/cli/src/tests/**/*.js",
"packages/cli/src/smoke-tests/**/*.js",
],

languageOptions: {
globals: {
...globals.mocha,
},
},

rules: {
"mocha/no-exclusive-tests": "error",
},
}, {
files: ["packages/cli/snippets/**/*.js"],

languageOptions: {
globals: {
...globals.mocha,
},
},

rules: {
"no-unused-vars": 0,
},
}];
4 changes: 2 additions & 2 deletions example-apps/babel/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ const App = {
afterResponse: [],

resources: {
[Recipe.key]: Recipe
[Recipe.key]: Recipe,
},

triggers: {},

searches: {},

creates: {}
creates: {},
};

export default App;
2 changes: 1 addition & 1 deletion example-apps/basic-auth/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const handleBadResponses = (response, z, bundle) => {
// This message is surfaced to the user
'The username and/or password you supplied is incorrect',
'AuthenticationError',
response.status
response.status,
);
}

Expand Down
4 changes: 2 additions & 2 deletions example-apps/basic-auth/test/authentication.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('basic auth', () => {

expect(response.status).toBe(200);
expect(response.request.headers.Authorization).toBe(
'Basic dXNlcjpzZWNyZXQ='
'Basic dXNlcjpzZWNyZXQ=',
);
});

Expand All @@ -34,7 +34,7 @@ describe('basic auth', () => {
await appTester(App.authentication.test, bundle);
} catch (err) {
expect(err.message).toContain(
'The username and/or password you supplied is incorrect'
'The username and/or password you supplied is incorrect',
);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions example-apps/callback/test/creates.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('creates', () => {
const bundle = { inputData: { question: 'Will this work?' } };
const result = await appTester(
App.creates.prediction.operation.perform,
bundle
bundle,
);
expect(result).toMatchObject({
status: '...thinking...',
Expand All @@ -35,7 +35,7 @@ describe('creates', () => {

const result = await appTester(
App.creates.prediction.operation.performResume,
bundle
bundle,
);
expect(result).toMatchObject({
status: 'success',
Expand Down
4 changes: 2 additions & 2 deletions example-apps/create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const App = {

// If you want your creates to show up, you better include it here!
creates: {
[recipe.key]: recipe
}
[recipe.key]: recipe,
},
};

// Finally, export the app.
Expand Down
8 changes: 4 additions & 4 deletions example-apps/create/test/creates.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ const appTester = zapier.createAppTester(App);

describe('creates', () => {
describe('create recipe create', () => {
it('should create a new recipe', done => {
it('should create a new recipe', (done) => {
const bundle = {
inputData: {
name: 'Smith Family Recipe',
directions: '1. Order out :)',
authorId: 1
}
authorId: 1,
},
};

appTester(App.creates.recipe.operation.perform, bundle)
.then(result => {
.then((result) => {
result.should.have.property('name');
done();
})
Expand Down
2 changes: 1 addition & 1 deletion example-apps/custom-auth/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const handleBadResponses = (response, z, bundle) => {
// This message is surfaced to the user
'The API Key you supplied is incorrect',
'AuthenticationError',
response.status
response.status,
);
}

Expand Down
2 changes: 1 addition & 1 deletion example-apps/digest-auth/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const handleBadResponses = (response, z, bundle) => {
// This message is surfaced to the user
'The username and/or password you supplied is incorrect',
'AuthenticationError',
response.status
response.status,
);
}

Expand Down
2 changes: 1 addition & 1 deletion example-apps/digest-auth/test/authentication.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('digest auth', () => {
await appTester(App.authentication.test, bundle);
} catch (err) {
expect(err.message).toContain(
'The username and/or password you supplied is incorrect'
'The username and/or password you supplied is incorrect',
);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions example-apps/dynamic-dropdown/test/triggers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('triggers', () => {

const results = await appTester(
App.triggers.species.operation.perform,
bundle
bundle,
);
expect(results.length).toBeGreaterThan(1);

Expand All @@ -33,7 +33,7 @@ describe('triggers', () => {

const results = await appTester(
App.triggers.people.operation.perform,
bundle
bundle,
);
expect(results.length).toBeGreaterThan(1);

Expand Down
6 changes: 3 additions & 3 deletions example-apps/files/test/creates.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('uploadFile', () => {
test('upload file v10', async () => {
if (CORE_VERSION[0] < 10) {
console.warn(
`skipped because this only works on core v10+ and you're on ${zapier.version}`
`skipped because this only works on core v10+ and you're on ${zapier.version}`,
);
return;
}
Expand All @@ -34,7 +34,7 @@ describe('uploadFile', () => {

const result = await appTester(
App.creates.uploadFile_v10.operation.perform,
bundle
bundle,
);
expect(result.filename).toBe('sample.pdf');
expect(result.file.sha1).toBe(EXPECTED_SHA1);
Expand All @@ -52,7 +52,7 @@ describe('uploadFile', () => {

const result = await appTester(
App.creates.uploadFile_v9.operation.perform,
bundle
bundle,
);
expect(result.filename).toBe('sample.pdf');
expect(result.file.sha1).toBe(EXPECTED_SHA1);
Expand Down
2 changes: 1 addition & 1 deletion example-apps/files/test/hydrators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('downloadFile', () => {

const url = await appTester(App.hydrators.downloadFile, bundle);
expect(url).toContain(
'https://zapier-dev-files.s3.amazonaws.com/cli-platform/'
'https://zapier-dev-files.s3.amazonaws.com/cli-platform/',
);
});
});
2 changes: 1 addition & 1 deletion example-apps/files/test/triggers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('newFile', () => {
const bundle = {};
const results = await appTester(
App.triggers.newFile.operation.perform,
bundle
bundle,
);

expect(results.length).toBeGreaterThan(0);
Expand Down
22 changes: 11 additions & 11 deletions example-apps/github/samples/sample_issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ module.exports = {
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url: 'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false
site_admin: false,
},
labels: [
{
id: 208045946,
url: 'https://api.github.com/repos/octocat/Hello-World/labels/bug',
name: 'bug',
color: 'f29513',
default: true
}
default: true,
},
],
assignee: {
login: 'octocat',
Expand All @@ -60,7 +60,7 @@ module.exports = {
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url: 'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false
site_admin: false,
},
assignees: [
{
Expand All @@ -83,8 +83,8 @@ module.exports = {
received_events_url:
'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false
}
site_admin: false,
},
],
milestone: {
url: 'https://api.github.com/repos/octocat/Hello-World/milestones/1',
Expand Down Expand Up @@ -116,22 +116,22 @@ module.exports = {
received_events_url:
'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false
site_admin: false,
},
open_issues: 4,
closed_issues: 8,
created_at: '2011-04-10T20:09:31Z',
updated_at: '2014-03-03T18:58:10Z',
closed_at: '2013-02-12T13:22:01Z',
due_on: '2012-10-09T23:39:01Z'
due_on: '2012-10-09T23:39:01Z',
},
locked: false,
comments: 0,
pull_request: {
url: 'https://api.github.com/repos/octocat/Hello-World/pulls/1347',
html_url: 'https://github.com/octocat/Hello-World/pull/1347',
diff_url: 'https://github.com/octocat/Hello-World/pull/1347.diff',
patch_url: 'https://github.com/octocat/Hello-World/pull/1347.patch'
patch_url: 'https://github.com/octocat/Hello-World/pull/1347.patch',
},
closed_at: null,
created_at: '2011-04-22T13:33:48Z',
Expand All @@ -154,6 +154,6 @@ module.exports = {
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url: 'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false
}
site_admin: false,
},
};
8 changes: 4 additions & 4 deletions example-apps/github/samples/sample_repo_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url: 'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false
site_admin: false,
},
name: 'Hello-World',
full_name: 'octocat/Hello-World',
Expand Down Expand Up @@ -109,7 +109,7 @@ module.exports = {
permissions: {
admin: false,
push: false,
pull: true
pull: true,
},
allow_rebase_merge: true,
allow_squash_merge: true,
Expand All @@ -121,6 +121,6 @@ module.exports = {
name: 'MIT License',
spdx_id: 'MIT',
url: 'https://api.github.com/licenses/mit',
html_url: 'https://choosealicense.com/licenses/mit/'
}
html_url: 'https://choosealicense.com/licenses/mit/',
},
};
Loading
Loading