Skip to content

Commit

Permalink
Start experimenting with eslint-8
Browse files Browse the repository at this point in the history
  • Loading branch information
onigoetz committed Aug 30, 2021
1 parent e46004a commit 950fa8d
Show file tree
Hide file tree
Showing 10 changed files with 192 additions and 210 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
},
"engines": {
"node": ">=12"
},
"resolutions": {
"**/eslint": "8.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/crafty-preset-eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@swissquote/rollup-plugin-eslint": "1.15.0",
"copy-anything": "2.0.3",
"debug": "^4.1.0",
"eslint": "7.32.0",
"eslint": "8.0.0-beta.1",
"eslint-webpack-plugin": "2.5.4",
"merge-anything": "4.0.1",
"resolve-from": "5.0.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/crafty-preset-eslint/src/commands/jsLint.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ if (process.argv[2] === "jsLint") {
process.argv.splice(2, 1);
}

process.argv.push("--resolver");
process.argv.push(require.resolve("../resolver.js"))

process.argv.push("--config");
process.argv.push(tmpfile);

Expand Down
3 changes: 0 additions & 3 deletions packages/crafty-preset-eslint/src/eslintConfigurator.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ function stringifyConfiguration(configuration) {
// This file is generated to improve IDE Integration
// You don't need to commit this file, nor need it to run \`crafty build\`
// Fix module resolution
require(${JSON.stringify(require.resolve("./patchModuleResolver"))});
module.exports = ${JSON.stringify(configuration, null, 4)};
`;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/crafty-preset-eslint/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ module.exports = {
chain.plugin("lint-js").use(require.resolve("eslint-webpack-plugin"), [
{
extensions: crafty.config.eslintExtensions,
overrideConfigFile: toTempFile(crafty.config.eslint)
overrideConfigFile: toTempFile(crafty.config.eslint),
resolver: require.resolve("@swissquote/crafty-preset-eslint/src/resolver.js")
}
]);
}
Expand Down
149 changes: 0 additions & 149 deletions packages/crafty-preset-eslint/src/patchModuleResolver.js

This file was deleted.

18 changes: 18 additions & 0 deletions packages/crafty-preset-eslint/src/resolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const {
Legacy: { ModuleResolver },
} = require("@eslint/eslintrc");

function resolve(moduleName, relativeToPath) {
console.log("resolving", { moduleName, relativeToPath });
try {
// First check for the module relative to the current location
return ModuleResolver.resolve(moduleName, __filename);
} catch (e) {
// OR fallback to the default behaviour of ESLint
return ModuleResolver.resolve(moduleName, relativeToPath);
}
}

module.exports = {
resolve,
};
8 changes: 4 additions & 4 deletions packages/eslint-plugin-swissquote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"dependencies": {
"@babel/eslint-parser": "7.15.0",
"@swissquote/babel-preset-swissquote": "1.15.0",
"@typescript-eslint/eslint-plugin": "4.30.0",
"@typescript-eslint/parser": "4.30.0",
"@typescript-eslint/eslint-plugin": "5.0.0-alpha.25",
"@typescript-eslint/parser": "5.0.0-alpha.25",
"confusing-browser-globals": "1.0.10",
"eslint-config-prettier": "8.3.0",
"eslint-import-resolver-typescript": "2.4.0",
Expand All @@ -34,10 +34,10 @@
"typescript": "4.4.2"
},
"peerDependency": {
"eslint": "^6.0.0 | ^7.0.0"
"eslint": "^6.0.0 | ^7.0.0 | ^8.0.0"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint": "8.0.0-beta.1",
"jest": "27.1.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/rollup-plugin-eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
},
"dependencies": {
"@rollup/pluginutils": "4.1.1",
"eslint": "7.32.0"
"eslint": "8.0.0-beta.1"
}
}
Loading

0 comments on commit 950fa8d

Please sign in to comment.