xojs/xo

v0.13.0 crashes on plugin shared config #88

jamestalmage posted onGitHub

I tried to use:

"overrides": [
  {
    "files": ["test.js"],
    "extends": ["plugin:ava/recommended"]
  }
]

And things crashed.

TypeError: Cannot read property 'charAt' of null
    at posix (/Users/jamestalmage/WebstormProjects/async-task-pool/node_modules/path-is-absolute/index.js:4:13)
    at isFilePath (/Users/jamestalmage/WebstormProjects/async-task-pool/node_modules/eslint/lib/config/config-file.js:80:12)
    at /Users/jamestalmage/WebstormProjects/async-task-pool/node_modules/eslint/lib/config/config-file.js:344:20
    at Array.reduceRight (native)
    at Object.applyExtends (/Users/jamestalmage/WebstormProjects/async-task-pool/node_modules/eslint/lib/config/config-file.js:338:28)
    at loadConfig (/Users/jamestalmage/WebstormProjects/async-task-pool/node_modules/eslint/lib/config.js:63:37)
    at new Config (/Users/jamestalmage/WebstormProjects/async-task-pool/node_modules/eslint/lib/config.js:171:44)
    at CLIEngine.executeOnFiles (/Users/jamestalmage/WebstormProjects/async-task-pool/node_modules/eslint/lib/cli-engine.js:493:28)
    at runEslint (/Users/jamestalmage/WebstormProjects/async-task-pool/node_modules/xo/index.js:67:16)
    at /Users/jamestalmage/WebstormProjects/async-task-pool/node_modules/xo/index.js:40:11

I am not sure if it is overrides specific


I am not sure if it is overrides specific

It does not appear to be

posted by jamestalmage almost 9 years ago

@jamestalmage Probably https://github.com/sindresorhus/xo/blob/bfb1b4fed0e6b8d946c341bdc06f65d63265a0db/options-manager.js#L105-L116 Maybe we should ask ESLint to expose that method?

posted by sindresorhus almost 9 years ago

I'm getting the same error when I do this in the package.json:

  "xo": {
    "space": 2,
    "plugin": ["lodash-fp"],
    "extends": ["plugin:lodash-fp/recommended"]
  }

or with the cli

xo --plugin lodash-fp --extend plugin:eslint-plugin-lodash-fp/recommended

but it works fine when I go and modify xo configuration in the node_modules

module.exports = {
    plugins: [
        'lodash-fp',
        'no-use-extend-native',
        'import-order',
        'ava',
        'xo',
        'promise'
    ],
    extends: [
        'plugin:lodash-fp/recommended',
        'plugin:ava/recommended',
        'plugin:xo/recommended'
    ],
    rules: {
        'no-use-extend-native/no-use-extend-native': 2,
        'import-order/import-order': 2,
        'promise/param-names': 2
    }
};

(v0.15)

posted by jfmengels almost 9 years ago

https://github.com/sindresorhus/xo/blob/6ec33e9776bb0da6b79529969c1c32aa098f0efc/options-manager.js#L122-L136

v0.16

Just got this. If you try to use a plugin, it results in the options array passed to eslint having a null in the extends array (because resolve-from doesn't find it). Tried a few other ways, but couldn't get a plugin's recommended config to work in any way.. Any steps forward with this?

posted by Tapppi over 8 years ago

Any steps forward with this?

Opening an issue on ESLint asking them to expose the method for resolving extends, so we don't have to implement a "broken" version ourselves. https://github.com/eslint/eslint/issues

posted by sindresorhus over 8 years ago

Any steps backward with this to make it work i.e. any previous version of xo or eslint which can fix this issue?

posted by abhisekp over 8 years ago
posted by sindresorhus over 8 years ago

The ESLint team says the underlying problem has been fixed in ESLint, so we should be able to rip out our custom resolve logic: https://github.com/xojs/xo/blob/510d02e3c4d26d07a7ba9bdcbd03f93987d596bb/lib/options-manager.js#L254-L282

We need to add a lot of test to confirm everything is still working though.

posted by sindresorhus about 6 years ago

@issuehuntfest has funded $80.00 to this issue. See it on IssueHunt

posted by IssueHuntBot about 6 years ago

I think current resolve logic on shared config still don't include baseConfig.cwd

posted by yaodingyd about 6 years ago

Eslint has a rfc https://github.com/eslint/rfcs/pull/7 to simplify the resolution of sharable configs. Maybe we wait on this first.

posted by yaodingyd about 6 years ago

Yeah, probably smart.

posted by sindresorhus about 6 years ago

Closing as this will be fixed with #702

posted by sindresorhus 8 months ago

The bounty from this issue has moved to #702

posted by sindresorhus 8 months ago

Fund this Issue

$80.00
Funded

Pull requests

Recent activities

issuehuntfest funded 80.00 for xojs/xo# 88
about 6 years ago