Skip to content

Commit

Permalink
chore: linting (floydspace#417)
Browse files Browse the repository at this point in the history
* chore(deps): updated dev dependencies

* chore: updating linting rules

* test: updated snapshots

* chore: linting fixes

* chore(deps): updated dependencies

- ran `npm audit fix`

* chore: use @floydspace eslint rules, fixed occurrences

* chore: revert snapshot hunks

Co-authored-by: Victor Korzunin <[email protected]>
  • Loading branch information
webdeveric and floydspace authored Dec 31, 2022
1 parent c587c47 commit 744dbb4
Show file tree
Hide file tree
Showing 29 changed files with 4,195 additions and 1,377 deletions.
1 change: 1 addition & 0 deletions .eslintignore
31 changes: 8 additions & 23 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
root: true
env:
node: true
ignorePatterns:
- dist
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
- '@floydspace/eslint-config/lib'
- '@floydspace/eslint-config/jest'
rules:
semi: 'off'
quotes: 'off'
no-use-before-define: 'off'
'@typescript-eslint/no-var-requires': 'off'
'@typescript-eslint/explicit-function-return-type': 'off'
'@typescript-eslint/explicit-module-boundary-types': 'off'
'@typescript-eslint/semi': error
'@typescript-eslint/quotes':
- error
- single
'@typescript-eslint/no-use-before-define':
- error
- functions: false
classes: false
'@typescript-eslint/naming-convention': off
jest/no-conditional-expect: off
overrides:
- files:
- "**/*.test.ts"
- 'examples/**/*.[tj]s'
rules:
'@typescript-eslint/no-explicit-any': 'off'

import/no-unresolved: off
no-promise-executor-return: off
no-console: off
8 changes: 5 additions & 3 deletions e2e/__snapshots__/individually.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ exports[`individually 2`] = `

exports[`individually 3`] = `"2010-09-09"`;

exports[`individually 4`] = `
exports[`individually 4`] = `"The AWS CloudFormation template for this Serverless application"`;

exports[`individually 5`] = `
{
"Hello1LambdaFunctionQualifiedArn": {
"Description": "Current Lambda function version",
Expand Down Expand Up @@ -69,7 +71,7 @@ exports[`individually 4`] = `
}
`;
exports[`individually 5`] = `
exports[`individually 6`] = `
{
"ApiGatewayMethodHello1Get": {
"DependsOn": [
Expand Down Expand Up @@ -510,7 +512,7 @@ exports[`individually 5`] = `
}
`;
exports[`individually 6`] = `
exports[`individually 7`] = `
{
"DependsOn": [
"ApiGatewayMethodHello1Get",
Expand Down
8 changes: 5 additions & 3 deletions e2e/__snapshots__/minimal.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13923,7 +13923,9 @@ module.exports.handler = (event, context, callback) => {

exports[`minimal 2`] = `"2010-09-09"`;

exports[`minimal 3`] = `
exports[`minimal 3`] = `"The AWS CloudFormation template for this Serverless application"`;

exports[`minimal 4`] = `
{
"ServerlessDeploymentBucketName": {
"Export": {
Expand Down Expand Up @@ -13971,7 +13973,7 @@ exports[`minimal 3`] = `
}
`;

exports[`minimal 4`] = `
exports[`minimal 5`] = `
{
"ApiGatewayMethodValidateDashisinIsinVarGet": {
"DependsOn": [
Expand Down Expand Up @@ -14285,7 +14287,7 @@ exports[`minimal 4`] = `
}
`;

exports[`minimal 5`] = `
exports[`minimal 6`] = `
{
"DependsOn": [
"ApiGatewayMethodValidateDashisinIsinVarGet",
Expand Down
2 changes: 2 additions & 0 deletions e2e/complete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ test('complete', () => {
const cloudformation = require(path.join(testArtifactPath, 'cloudformation-template-update-stack.json'));

const indexContents = fs.readFileSync(path.join(testArtifactPath, 'src/index.js')).toString();

expect(indexContents).toMatchSnapshot();

const nodeModules = fs.readdirSync(path.join(testArtifactPath, 'node_modules')).toString();

expect(nodeModules).toEqual(expect.stringContaining('isin-validator'));

expect(cloudformation.AWSTemplateFormatVersion).toMatchSnapshot();
Expand Down
7 changes: 6 additions & 1 deletion e2e/individually.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ test('individually', () => {

const hello1indexContents = fs.readFileSync(path.join(testArtifactPath, 'hello1.js')).toString();
const hello2indexContents = fs.readFileSync(path.join(testArtifactPath, 'hello2.js')).toString();

expect(hello1indexContents).toMatchSnapshot();

expect(hello2indexContents).toMatchSnapshot();

expect(cloudformation.AWSTemplateFormatVersion).toMatchSnapshot();
expect(cloudformation.Description).toMatchSnapshot;

expect(cloudformation.Description).toMatchSnapshot();

expect(cloudformation.Outputs).toMatchSnapshot({
Hello1LambdaFunctionQualifiedArn: {
Value: { Ref: expect.any(String) },
Expand All @@ -22,7 +25,9 @@ test('individually', () => {
Value: { Ref: expect.any(String) },
},
});

expect(cloudformation.Outputs.Hello1LambdaFunctionQualifiedArn.Value.Ref).toMatch(/^Hello1LambdaVersion/);

expect(cloudformation.Outputs.Hello2LambdaFunctionQualifiedArn.Value.Ref).toMatch(/^Hello2LambdaVersion/);

const apiGatewayDeploymentPropertyKey = Object.keys(cloudformation.Resources).find((s) =>
Expand Down
6 changes: 5 additions & 1 deletion e2e/minimal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ test('minimal', () => {
const cloudformation = require(path.join(testArtifactPath, 'cloudformation-template-update-stack.json'));

const indexContents = fs.readFileSync(path.join(testArtifactPath, 'index.js')).toString();

expect(indexContents).toMatchSnapshot();

expect(cloudformation.AWSTemplateFormatVersion).toMatchSnapshot();
expect(cloudformation.Description).toMatchSnapshot;

expect(cloudformation.Description).toMatchSnapshot();

expect(cloudformation.Outputs).toMatchSnapshot({
ValidateIsinLambdaFunctionQualifiedArn: {
Value: { Ref: expect.any(String) },
},
});

expect(cloudformation.Outputs.ValidateIsinLambdaFunctionQualifiedArn.Value.Ref).toMatch(/^ValidateIsinLambdaVersion/);

const apiGatewayDeploymentPropertyKey = Object.keys(cloudformation.Resources).find((s) =>
Expand Down
2 changes: 1 addition & 1 deletion examples/individually/plugins.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let envPlugin = {
const envPlugin = {
name: 'log-lodash',
setup(build) {
// test interception : log all lodash imports
Expand Down
Loading

0 comments on commit 744dbb4

Please sign in to comment.