question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Overrides not working when calling xo with absolute paths

See original GitHub issue

Issuehunt badges

I have this in my package.json:

"xo": {
  "extends": "xo-react",
  "parser": "babel-eslint",
  "plugins": ["react"],
  "envs": ["node", "browser"],
  "rules": {
    "react/forbid-component-props": 0,
    "react/jsx-closing-bracket-location": ["error", "tag-aligned"]
  },
  "overrides": [{
    "files": "src/client/components/*.js",
    "rules": {
      "unicorn/filename-case": [
        "error", {"case": "pascalCase"}
      ]
    }
  }, {
    "files": "src/client/containers/*.js",
    "rules": {
      "unicorn/filename-case": [
        "error",
        {"case": "pascalCase"}
      ]
    }
  }]
}

And I have the file src/client/components/ExtendedReferenceManyField.js

Now, if I call

$ xo src/client/components/ExtendedReferenceManyField.js

it finishes without errors. However, calling:

$ xo /home/user/dev/project/src/client/components/ExtendedReferenceManyField.js

will output:

  src/client/components/ExtendedReferenceManyField.js:1:1
  ✖  1:1  Filename is not in kebab case. Rename it to extended-reference-many-field.js.  unicorn/filename-case

  1 error

I stumbled on this while using lint-staged in my project.


xo version: 0.18.2 Node version: 6.10.1 OS: Linux Mint 18 Cinnamon 64-bit

futpib earned $60.00 by resolving this issue!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zanonacommented, Dec 30, 2017

I believe I have fallen into the same issue when using lint-staged (http://npmjs.com/package/lint-staged) where it may be the case it sends absolute paths since my overrides config has no effect at all.

This Fails

{
  "lint-staged": {
    "*.js": [
      "xo --fix",
      "git add"
    ]
  },
  "xo": {
    "semicolon": false,
    "overrides": [
      {
        "files": "packages/shop-app/**",
        "envs": [
          "node",
          "browser"
        ]
      }
    ]
}
$ lint-staged
✔ Running tasks for package.json
❯ Running tasks for *.js
   ✖ xo --fix
     → ✖   24:4   postMessage is not defined.
     git add
✖ xo --fix found some errors. Please fix them and try committing again.

This Works

{
  "lint-staged": {
    "*.js": [
      "xo --fix",
      "git add"
    ]
  },
  "xo": {
    "semicolon": false,
    "overrides": [
      {
        "files": "/Users/zanona/Developer/my-app/packages/shop-app/**",
        "envs": [
          "node",
          "browser"
        ]
      }
    ]
}
$ lint-staged
✔ Running tasks for package.json
✔ Running tasks for *.js
0reactions
IssueHuntBotcommented, May 10, 2019

@sindresorhus has rewarded $54.00 to @futpib. See it on IssueHunt

  • 💰 Total deposit: $60.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $6.00
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug] Absolute path for overrides group does not work like ...
The override syntax does not allow for absolute path referencing with /group/config . This is possible in the defaults list. I think it...
Read more >
absolute path with react, react-app-rewire and typescript
im stuck with connecting all the dots, it doesn't work and i still cant see what i need to do in order to...
Read more >
Local Overrides Not Working - Google Groups
Configure (enable) Local Overrides; From DevTools > Network panel, right click on webpage1.html and select 'Save for overrides' (only showing up for Canary) ......
Read more >
LilyPond snippets: Tweaks and overrides
Showing the same articulation above and below a note or chord. By default, LilyPond does not allow the same articulation (e.g., an accent,...
Read more >
ModelSim Command Reference Manual - Microsemi
MENTOR GRAPHICS SHALL NOT BE LIABLE FOR ANY INCIDENTAL, INDIRECT, SPECIAL, OR. CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found