Skip to content

WRR-16854: Upgrade to eslint 9 flat config #14

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Standalone "ESLint config" package which acts as a dynamic forwarder, dynamicall

## Usage

Reference this set of rules from your `.eslintrc` or `package.json` file and then use `eslint`.
Reference this set of rules from your `eslint.config.js` file and then use `eslint`.

For more information (including editor/IDE setup), please see the [Enact ESLint config docs](https://github.com/enactjs/eslint-config-enact/blob/master/docs/index.md).

Expand Down
8 changes: 8 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const eslintEnactProxy = require('./strict');
const { FlatCompat } = require("@eslint/eslintrc");

const compat = new FlatCompat({});
console.log(eslintEnactProxy);
module.exports = [
...eslintEnactProxy,
];
7 changes: 6 additions & 1 deletion get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ function getGlobalConfig({
].find(dir => fs.existsSync(dir));
if (eslintResolverPath) {
let eslintResolver;

console.log("2", eslintResolverPath);

if (eslintResolverPath.includes('eslintrc')) {
const eslintrcPath = path.join(eslintResolverPath, '..', '..', '..');
Expand All @@ -52,12 +54,15 @@ function getGlobalConfig({
}

supportGlobalResolving(eslintResolver, search);

console.log("3", eslintResolver);
console.log("4", ruleset);
}
// If eslint/lib/shared/relative-module-resolver.js does not exist, then
// our global resolving support cannot be patched in.
// As a meaningful fallback, and to backward-support ESLint <=5.x, still
// should extend the desired ruleset.
return {extends: ruleset};
return ruleset;
}

module.exports = {
Expand Down
2 changes: 2 additions & 0 deletions global-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ const npmGlobalModules = () => execSync('npm root -g');
const yarnGlobalModules = () => execSync('yarn global dir');

const supportGlobalResolving = (resolver, globalPaths) => {
console.log("test", globalPaths);
const doResolve = resolver.resolve;
if (!Array.isArray(globalPaths)) globalPaths = [globalPaths];
resolver.resolve = function(moduleName, relativeToPath) {
console.log("5",`[${moduleName}] ${relativeToPath}`);
try {
// attempt normal resolving to support local & overrides
return doResolve.call(resolver, moduleName, relativeToPath);
Expand Down
282 changes: 282 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
},
"dependencies": {
"semver": "^7.6.3"
},
"devDependencies": {
"@eslint/eslintrc": "^3.2.0"
}
}