Skip to content
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

xo ignoring configuration file? #506

Closed
IPWright83 opened this issue Nov 10, 2020 · 4 comments
Closed

xo ignoring configuration file? #506

IPWright83 opened this issue Nov 10, 2020 · 4 comments
Labels

Comments

@IPWright83
Copy link

This could be a configuration problem, but I started first encountered these issues after upgrading xo. I'm seeing 2 different issues where it looks like xo is ignoring the config I've given it and using some default settings. I have no configuration in package.json that could override any of these settings.

So defined at the root I've got:

xo.config.js

module.exports = {
    extends: ['prettier'],
    overrides: [
        {
            files: ['**/*.test.js', '__mocks__/**'],
            envs: ['jest'],
        },
    ],
    envs: ['node'],
    rules: {
        'capitalized-comments': 'off',
        camelcase: 'off',
        eqeqeq: ['error', 'smart'],
        indent: 'off',
        'import/no-unassigned-import': 'off',
        'unicorn/filename-case': 'off',
        'unicorn/no-null': 'off',
        'unicorn/prevent-abbreviations': 'off',
        'unicorn/string-content': 'off',
        'node/no-mixed-requires': 'off',
        'node/no-new-require': 'off',
        'node/no-path-concat': 'off',
        'valid-jsdoc': [
            1,
            {
                requireReturn: false,
                requireParamType: true,
                requireReturnType: true,
            },
        ],
    },
    space: true,
};

prettier.config.js

module.exports = {
    arrowParens: 'always',
    printWidth: 100,
    singleQuote: true,
    trailingComma: 'es5',
    tabWidth: 4,
};

Yet both the rules in the xo config (space: true) and the rules in the prettier config (trailingComma: "es5") seem to not being used. When I run xo . at the root of the project:

prettier.config.js:2:1
✖ 2:1 Expected indentation of 1 tab but found 4 spaces. indent
✖ 3:1 Expected indentation of 1 tab but found 4 spaces. indent
✖ 4:1 Expected indentation of 1 tab but found 4 spaces. indent
✖ 5:1 Expected indentation of 1 tab but found 4 spaces. indent
✖ 6:1 Expected indentation of 1 tab but found 4 spaces. indent
✖ 6:16 Unexpected trailing comma. comma-dangle

@sindresorhus
Copy link
Member

The first thing I would do is to try to place the config in package.json to rule out a problem with the config file resolution.

There's some special Prettier handling that might not take into account the space option. That would be my best guess.

@gregorskii
Copy link

gregorskii commented Feb 2, 2021

Is there a way to tell XO to output the config tree? IE --debug?

NM I see #188

EDIT: looks like that task is open and in the help wanted category right now.

EDIT 2: def seeing the same issue, it's not hunting a folder up for a xo-config.js file. In that file have I have defined some rule overrides that are not applying in a nested folder that has its own package json. I have not defined a xo config in the child project, just the root. Tried package.json based config and a xo-config.json and xo-config.js etc.

@natseg
Copy link

natseg commented Jul 21, 2021

I was encountering the same issue in one of our repositories.
But I could not find the root cause.
@ben-eb finally identified the problem: I had added a very broad json pattern to the .gitignore file.
I would recommend checking all globs in .gitignore, in case.

@xojs xojs deleted a comment from titanism Jun 10, 2022
@fregante fregante added the bug label Jan 4, 2023
@fregante
Copy link
Member

fregante commented Feb 20, 2023

Closing as stale and likely duplicate of:

For newcomers: Please read the existing comments or open a new issue with up to date details if this happens to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants