Skip to content

Conversation

@chinesedfan
Copy link
Contributor

@chinesedfan chinesedfan commented Apr 20, 2019

Close #58.

Before merging, let's discuss something.

  1. The main API, awesomeLint(), has been changed from Promise<VFile> to Promise<VFile[]>. Although I have updated docs. Is it acceptable or are there better solutions?
  2. In docs, awesomeLint.report(options) didn't mention options.config. Is it a public option or private? My current implementation follows original codes to use it to config rules for readme file, but users have no way to config rules for code-of-conduct file now.
  3. How to send extra information to rule implementations? For example, repoURL in this case. I didn't find a good way except for adding it to the VFile object.

@sindresorhus
Copy link
Owner

  1. That's fine.
  2. It's private. Do you see any need to make it public? If so, why?
  3. I don't really know.

@chinesedfan
Copy link
Contributor Author

It's private. Do you see any need to make it public? If so, why?

@sindresorhus Sure. I just want to confirm my PR didn't break too much things. Now you can start to review detailed codes. Thanks.

const pkgJsonFile = path.resolve(dirname, 'package.json');
if (fs.existsSync(pkgJsonFile)) {
const json = require(pkgJsonFile);
if (json && json.repository) {
Copy link
Owner

Choose a reason for hiding this comment

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

You are making assumption about the format of repository that are not always true. repository can have many different formats.

You're also making assumption that the package.json is in the same directory as the readme.

Use https://github.com/sindresorhus/read-pkg-up to have the data normalized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion. But I chose read-pkg instead of read-pkg-up.

This project has made the assumption that readme file is in the root directory of the project. So don't searching package.json in parent directories, and that will make writing test hard. Because read-pkg-up may find the package.json of awesome-lint itself and result in some misleadings.

@sindresorhus sindresorhus changed the title Add rule awesome/code-of-conduct Add awesome/code-of-conduct rule Jun 21, 2019
Co-Authored-By: Itai Steinherz <[email protected]>
@sindresorhus sindresorhus changed the title Add awesome/code-of-conduct rule Add awesome/code-of-conduct rule Nov 12, 2019
@sindresorhus sindresorhus merged commit ddbebd1 into sindresorhus:master Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure the maintainer has added their own email to the Code of Conduct

3 participants