Skip to content

Change import package - #2373

Open
jarqvi wants to merge 8 commits into
ajv-validator:masterfrom
jarqvi:refactor
Open

jarqvi wants to merge 8 commits into
ajv-validator:masterfrom
jarqvi:refactor

Conversation

@jarqvi

@jarqvi jarqvi commented Jan 28, 2024 •

Copy link
Copy Markdown

What issue does this pull request resolve?
In fact, some codes that were not needed much have been removed.

What changes did you make?
The recent removal of the line ‍‍‍const {default: Ajv} = require('ajv') was made possible by eliminating the export statement module.exports.default = AjvClass. As a result, we no longer require the named import of the Ajv module.

And since we mentioned the following code sample in the documentation, I don't think there is a problem:
const Ajv = require("ajv")

Is there anything that requires more attention while reviewing?
require packages in CJS

@jarqvi

jarqvi commented Jan 29, 2024 •

Copy link
Copy Markdown
Author

Or at least it can be as follows:
const {Ajv} = require('ajv')

The following also works:
const Ajv = require('ajv')

I feel the code is cleaner with this method instead of using the code below:
const {default: Ajv} = require('ajv')

@jarqvi

jarqvi commented Feb 24, 2024 •

Copy link
Copy Markdown
Author

@jasoniangreen what happened?!

@jarqvi jarqvi changed the title refactor: remove extra codes Change import package Feb 24, 2024
@jasoniangreen

Copy link
Copy Markdown
Collaborator

@jasoniangreen what happened?!

I just wanted to pull master into your branch so I can see if it passes and do a proper review in the up to date context.

@jarqvi

jarqvi commented Feb 25, 2024

Copy link
Copy Markdown
Author

Thanks.

@jasoniangreen

Copy link
Copy Markdown
Collaborator

Hi @jarqvi, I don't really understand why should make this change?

@jarqvi

jarqvi commented Jun 6, 2024 •

Copy link
Copy Markdown
Author

Hi @jasoniangreen,
I felt that it has more readability when importing package.

@jasoniangreen

Copy link
Copy Markdown
Collaborator

Hi @jasoniangreen, I felt that it has more readability when importing package.

Ah ok, but it would be a potentially breaking change, correct? Depending on how people are currently importing it?

@jarqvi

jarqvi commented Jun 17, 2024

Copy link
Copy Markdown
Author

Hi @jasoniangreen, I felt that it has more readability when importing package.

Ah ok, but it would be a potentially breaking change, correct? Depending on how people are currently importing it?

Well, we can make these changes by keeping the previous method and be backward compatible

@jarqvi

jarqvi commented Jul 13, 2024

Copy link
Copy Markdown
Author

Hi @jasoniangreen, I felt that it has more readability when importing package.

Ah ok, but it would be a potentially breaking change, correct? Depending on how people are currently importing it?

Well, we can make these changes by keeping the previous method and be backward compatible

@jasoniangreen Done.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants