-
Notifications
You must be signed in to change notification settings - Fork 33
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
API don't respect extend
#82
Comments
Hey @evilebottnawi! v3's Node API got quite an overhaul. Calling the const CLIEngine = require('npm-package-json-lint').CLIEngine;
const cliEngineOptions = {
configFile: './path/to/optional/configFile/with/extends',
cwd: process.cwd(),
useConfigFiles: true, // true if you want the CLIEngine to automatically look for .npmpackagejsonlintrc.json and npmpackagejsonlint.config.js files in the project hierarchy
rules: {} // rules object
};
const cliEngine = new CLIEngine(cliEngineOptions);
const patterns = ['./path/to/package.json/file'];
const results = cliEngine.executeOnPackageJsonFiles(patterns); |
@tclindner when i use linter programmly, using |
Hi @evilebottnawi - I'm sorry that you find the new API is misleading. 😢 If you prefer to use the linter directly you still can. Does something like this feel better to you? const CLIEngine = require('npm-package-json-lint').CLIEngine;
const NpmPackageJsonLint = require('npm-package-json-lint').NpmPackageJsonLint;
const cliEngine = new CLIEngine({configFile: './path/to/optional/configFile/with/extends'});
const config = cliEngine.getConfigForFile('./path/to/package.json');
new NpmPackageJsonLint().lint(
packageJsonData,
config.rules
); |
@tclindner i already found solution, like you write above. I think we can fix misleading api in version 4. Just allow linting programmatically without creating |
Hey @evilebottnawi and @ntwb - I took a look at ESLint's Node.js API and it looks like their
How are you using their linter without needing the |
Hey @evilebottnawi what do you think of the previous comment? It seems like ESLint follows this same practice. I'm happy to make changes if you can help me understand the differences between how you use ESLint's API and npm-package-json-lint's API. |
I don't think ESLint uses cosmic config, but we do in stylelint https://www.npmjs.com/package/cosmiconfig Is that what you were thinking of here @evilebottnawi ? (@evilebottnawi and I are both on the @stylelint team) |
i think using |
Thanks, @evilebottnawi and @ntwb. I've started implementing cosmicconfig based on your recommendation. I don't think that has any impact on the public API of this module, though. Can you confirm that you would like is a single method, |
Yes, linting should load extended config 👍 |
* Add logic to apply overrides Closes #96 * Update eslint-config-tc * Add cosmicconfig and switch to globby * Add new utils for ignore and file list * Add error handling to config * Add typedef to LintIssue * Add new linter and results helper * Add tests for utils * Tests for new linter * Add test for absolute paths * Add tests for overrides and extends * Add ignore support to cli reporter * Update api now that CLIEngine is no longer exported * Update Reporter.js * Add initial version of transformer * Add config tests * Update CHANGELOG.md Closes #82 * Update cosmicConfigTransformer.js * Ignore lint temporarily for beta * Fix file paths * Update ConfigValidator.test.js * Update ConfigValidator.test.js * Update NpmPackageJsonLint.test.js * Update getFileList.js * Update getFileList.js * Add default for base config directory * Add additional tests for overrides and local build script
When reporting a bug, please include:
Output error only which in configuration list without rules in extend.
Respect
extends
in apiIn
2
version all works good and as expected. Thanks!The text was updated successfully, but these errors were encountered: