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

Allow to resolve config path relative to working directory #1276

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@caub
Copy link

caub commented Jan 29, 2019

No description provided.

@caub caub force-pushed the caub:patch-1 branch from 31e4dbd to fcb7a82 Jan 29, 2019

@coveralls

This comment has been minimized.

Copy link

coveralls commented Jan 29, 2019

Coverage Status

Coverage decreased (-0.07%) to 94.037% when pulling 31e4dbd on caub:patch-1 into 9bac44e on benmosher:master.

@coveralls

This comment has been minimized.

Copy link

coveralls commented Jan 29, 2019

Coverage Status

Coverage decreased (-0.4%) to 93.684% when pulling eca0b37 on caub:patch-1 into bdc05aa on benmosher:master.

@caub caub force-pushed the caub:patch-1 branch from fcb7a82 to 392e8a1 Jan 29, 2019

Show resolved Hide resolved resolvers/webpack/README.md Outdated

@caub caub force-pushed the caub:patch-1 branch 7 times, most recently from 8f7fec4 to e673e65 Jan 29, 2019

@caub caub changed the title Allow to pass $dirname placeholder for absolute paths Allow to pass $PWD placeholder in config path Jan 29, 2019

@caub caub changed the title Allow to pass $PWD placeholder in config path Allow to resolve config path relative to working directory Jan 29, 2019

@caub caub force-pushed the caub:patch-1 branch from e673e65 to 1646f90 Jan 29, 2019

Show resolved Hide resolved resolvers/webpack/index.js Outdated

@caub caub force-pushed the caub:patch-1 branch 5 times, most recently from eec6ed8 to 47075bf Jan 29, 2019

@caub

This comment has been minimized.

Copy link
Author

caub commented Feb 7, 2019

is this good to go?

@caub caub force-pushed the caub:patch-1 branch from 47075bf to 3a6f261 Feb 7, 2019

Show resolved Hide resolved resolvers/webpack/index.js Outdated
Update relative path prefix
Co-Authored-By: caub <cyril.auburtin@gmail.com>
@caub

This comment has been minimized.

Copy link
Author

caub commented Feb 8, 2019

Thanks, I thought about it (for ../path/to paths), but thought to just use ./../ for now
it's committed, the tests pass locally but the CI here seems struggling, resolvers/webpack seems fine though

@caub

This comment has been minimized.

Copy link
Author

caub commented Feb 15, 2019

@benmosher Sorry to disturb, could we merge this? It's necessary for specifying custom webpack configs paths using .eslintrc json configs

@caub

This comment has been minimized.

Copy link
Author

caub commented Feb 20, 2019

I can confirm this PR works beautifully

here's my .eslintrc

{
    "extends": [
        "plugin:import/recommended", // can be used when https://github.com/benmosher/eslint-plugin-import/pull/1276 is merged
        "eslint:recommended",
        "plugin:react/recommended"
    ],
    "env": {
        "browser": true,
        "node": true,
        "es6": true,
        "mocha": true
    },
    "plugins": ["react", "import"],
    "settings": {
	    "import/resolver": {
            "webpack": {
                "config": "./frontend/config/webpack.config.prod.js"
            }
        }
    },
    "parser": "babel-eslint",
    "parserOptions": {
        "ecmaVersion": 2018,
        "ecmaFeatures": {
            "jsx": true
        },
        "sourceType": "module"
    },
    "rules": {
       //....
    }
}

with current eslint-import-resolver-webpack, it fails with :

Error resolving webpackConfig { Error: Cannot find module '/path/to/frontend/frontend/config/webpack.config.prod.js'

I tried adjusting the path to the webpack config in .eslintrc, without success

Now, if I edit node_modules/eslint-import-resolver-webpack/index.js with the changes in this PR, npx eslint . works:

✖ 269 problems (0 errors, 269 warnings)

ps: my case is a bit complex (there's a package.json in the root of my repo, and in frontend/ too

I hope this can be merged soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment