Skip to content

Commit

Permalink
1.0.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
hong6316 committed Apr 11, 2022
2 parents a663a0f + 357e205 commit f2ecb68
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The following is a curated list of changes in the Enact proxy ESLint config:

## [1.0.4] (April 11, 2022)

### Fixed

- Applied the new API to call ESLint module resolver correctly with the latest eslint.

## [1.0.3] (December 28, 2021)

No significant changes.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For more information (including editor/IDE setup), please see the [Enact ESLint
Unless otherwise specified, all content, including all source code files and
documentation files in this repository are:

Copyright (c) 2020 LG Electronics
Copyright (c) 2020-2022 LG Electronics

Unless otherwise specified or set forth in the NOTICE file, all content,
including all source code files and documentation files in this repository are:
Expand Down
24 changes: 23 additions & 1 deletion get-config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
const semver = require('semver');
const {npmGlobalModules, yarnGlobalModules, supportGlobalResolving} = require('./global-resolver');

// Find first parent module from the accessing ESLint.
Expand Down Expand Up @@ -29,7 +30,28 @@ function getGlobalConfig({
...search.map(dir => path.join(dir, 'eslint', 'lib', 'shared', 'relative-module-resolver.js'))
].find(dir => fs.existsSync(dir));
if (eslintResolverPath) {
supportGlobalResolving(eslintResolverPath, search);
let eslintResolver;

if (eslintResolverPath.includes('eslintrc')) {
const eslintrcPath = path.join(eslintResolverPath, '..', '..', '..');
const version = require(path.join(eslintrcPath, 'package.json')).version;
if (semver.gte(version, '0.4.1')) {
const {
Legacy: {
ModuleResolver
}
} = require(eslintrcPath);
eslintResolver = ModuleResolver;
} else if (semver.gte(version, '0.2.2')) {
eslintResolver = require(eslintResolverPath);
} else {
eslintResolver = require(path.join(eslintrcPath, '..', '..', '..', 'lib', 'shared', 'relative-module-resolver.js'));
}
} else {
eslintResolver = require(eslintResolverPath);
}

supportGlobalResolving(eslintResolver, search);
}
// If eslint/lib/shared/relative-module-resolver.js does not exist, then
// our global resolving support cannot be patched in.
Expand Down
3 changes: 1 addition & 2 deletions global-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ const npmGlobalModules = () => execSync('npm root -g');

const yarnGlobalModules = () => execSync('yarn global dir');

const supportGlobalResolving = (resolverFile, globalPaths) => {
const resolver = require(resolverFile);
const supportGlobalResolving = (resolver, globalPaths) => {
const doResolve = resolver.resolve;
if (!Array.isArray(globalPaths)) globalPaths = [globalPaths];
resolver.resolve = function(moduleName, relativeToPath) {
Expand Down
20 changes: 18 additions & 2 deletions npm-shrinkwrap.json

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

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-enact-proxy",
"version": "1.0.3",
"version": "1.0.4",
"description": "ESLint proxy config for global Enact ruleset",
"main": "index.js",
"author": "Jason Robitaille <[email protected]>",
Expand All @@ -12,5 +12,8 @@
"scripts": {
"lint": "eslint .",
"fix": "eslint . --fix"
},
"dependencies": {
"semver": "^7.3.6"
}
}

0 comments on commit f2ecb68

Please sign in to comment.