Open NullVoxPopuli opened 2 years ago
ah, this is also giving me trouble:
let currentPackageJSON = require(join(process.cwd(), 'package.json'));
let lttfPluginsNames = [
...Object.keys(currentPackageJSON.devDependencies || {}),
...Object.keys(currentPackageJSON.dependencies || {})
].filter(dep => dep.startsWith('lint-to-the-future-'));
I had tried to cd
to a project so lint-to-the-future would run more quickly, but there are checks to prevent that. :thinking:
I've made these edits: lint-to-the-future
async function main() {
// no need to check package.json
let pluginNames = [
'lint-to-the-future-eslint',
];
let lttfPluginsNames = pluginNames.filter(name => {
try {
return require(name);
} catch { /* module not found */ }
});
let lttfPlugins = lttfPluginsNames.map(name => ({
import: importCwd(name),
name,
}));
// ... (etc)
lint-to-the-future-eslint
async function ignoreAll(cwd = process.cwd()) {
// I happen to know I'm not using esilnt 8
// but if eslint exports a version at runtime, that could be used here
// instead of trying to find the correct package.json
let cli;
let report;
let results;
const eslint = require('eslint');
const { CLIEngine } = eslint;
cli = new CLIEngine();
report = cli.executeOnFiles([cwd]);
results = report.results;
const errors = results.filter((result) => result.errorCount > 0);
errors.forEach(ignoreError);
}
@NullVoxPopuli Do you know if this is still an issue? Thanks!
Haven't tried, sorry!
@NullVoxPopuli Do you know if this is still an issue? Thanks!
Yes. I've tried it today. Looks like we don't have monorepo support yet.
Update, I'm unblocked for now, but it'd be nice for lint-to-the-future to detect monorepo, and use the eslint available to the monorepo as a whole, or locally to each project (some projects may not even use eslint (maybe? lol))
I've traced that to this line: https://github.com/mansona/lint-to-the-future-eslint/blob/main/index.js#L38
the eslintVersion I have is:
I edited
node_modules
to see what was detected aseslintVersion
. It was undefined. While I was in there, I noticed the code was checking:so... thankfully, I have a bit of control here, so I can add
eslint
into devDeps of the root package.json. (it was recently remove and bundled with a lint-config package anyway, so :shrug:)After adding
eslint
to my root package.json, and re-running lint-to-the-future, things seem to be moving, although quite slowly -- I'll open another issue