Giter Site home page Giter Site logo

Comments (2)

fetwar avatar fetwar commented on September 25, 2024

I discovered one of my mono-repo projects had a .lintstagedrc.js file inside with no content.

Offending block that doesn't catch the error is searchConfigs:98, I will raise a PR for this one shortly.

Side note: is there a central place where unexpected errors are logged in lint-staged? It seems odd that an error improperly caught could cause the program to exit without logging anything at all, even just the error message and/or stack trace.

from lint-staged.

iiroj avatar iiroj commented on September 25, 2024

I cannot actually reproduce this error in the lint-staged repo itself. Adding an empty file test/.lintstagedrc.js works as expected:

  lint-staged:searchConfigs Found possible config files: [
  '/Users/iiro/git/lint-staged/test/unit/__mocks__/my-lint-staged-config/package.json',
  '/Users/iiro/git/lint-staged/test/.lintstagedrc.js',
  '/Users/iiro/git/lint-staged/.lintstagedrc.json',
  '/Users/iiro/git/lint-staged/package.json'
] +6ms
  lint-staged:loadConfig Loading configuration from `/Users/iiro/git/lint-staged/test/unit/__mocks__/my-lint-staged-config/package.json`... +0ms
  lint-staged:loadConfig Loading configuration from `/Users/iiro/git/lint-staged/test/.lintstagedrc.js`... +1ms
  lint-staged:loadConfig Loading configuration from `/Users/iiro/git/lint-staged/.lintstagedrc.json`... +0ms
  lint-staged:loadConfig Loading configuration from `/Users/iiro/git/lint-staged/package.json`... +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/iiro/git/lint-staged/test/unit/__mocks__/my-lint-staged-config/package.json`:
  lint-staged:loadConfig null +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/iiro/git/lint-staged/.lintstagedrc.json`:
  lint-staged:loadConfig { '*.js': 'eslint --fix', '*.{json,md}': 'prettier --write' } +0ms
  lint-staged:validateConfig Validating config from `/Users/iiro/git/lint-staged/.lintstagedrc.json`... +0ms
  lint-staged:validateConfig Validated config from `/Users/iiro/git/lint-staged/.lintstagedrc.json`: +0ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   '*.js': 'eslint --fix',
  lint-staged:validateConfig   '*.{json,md}': 'prettier --write'
  lint-staged:validateConfig } +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/iiro/git/lint-staged/package.json`:
  lint-staged:loadConfig null +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/iiro/git/lint-staged/test/.lintstagedrc.js`:
  lint-staged:loadConfig null +1ms
  lint-staged:searchConfigs Found 1 config files +2ms

So the file /Users/iiro/git/lint-staged/test/.lintstagedrc.js is treated as a possible config file, but its content gets resolved to null instead of lint-staged failing silently.

from lint-staged.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.