Stylelint causing issues when running as an npm script

I have configured stylelint for my project and it is running smoothly from the command line. Here is an example of the output when I run the following command:

$ stylelint 'css/**/*.css' --fix

css/style.css
 20:18  ×  Expected newline after ":" with a multi-line declaration declaration-colon-newline-after
...
...

However, when I try to run it as part of an npm script, there is no visible output (other than logging the command) and it appears that errors are being ignored:

$ npm run stylelint

> project lint:css path/project
> stylelint 'css/**/*.css' --fix    

This is how it looks in my package.json file:

  "scripts": {
    ...
    "stylelint": "stylelint 'css/**/*.css' --fix"
  },

Do you have any suggestions on how to display console output and exit on errors when running stylelint as an npm script?

Answer №1

It was discovered that the problem stemmed from using quotes around the globstar pattern. While many scripts accept single quotes ' for wrapping the globstar, stylelint necessitates escaped double quotes instead:

"stylelint": "stylelint \"src/**/*.css\" --fix"

Answer №2

By simply adding ; exit 0 at the end, it seems to work:

"stylelint": "stylelint 'css/**/*.css' --fix; exit 0"

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

create new Exception( "Invalid syntax, expression not recognized: " msg );

Can someone assist me in identifying the issue at hand? Error: There seems to be a syntax error, and the expression #save_property_#{result.id} is unrecognized. throw new Error( "Syntax error, unrecognized expression: " msg ); Here is the c ...

How can I incorporate a second main app.js file in Node.js to improve the organization and cleanliness of my codebase?

Hello, I am currently using Node.js and the Express framework for my project. All of my server-side code is contained within my app.js file, which has become quite complex with almost 250 lines of code. Now, I need to add authentication functionality to my ...

Modifying css background in real-time based on the current weather conditions

Is there a way to dynamically change the background image in CSS based on the weather condition? I'm utilizing the wunderground API to retrieve the weather data, which is stored in the weather variable. I am struggling with how to update the backgrou ...

The type 'Dispatch<SetStateAction<boolean>>' cannot be assigned to type 'boolean'

Currently, I am attempting to transfer a boolean value received from an onChange function to a state variable. let [toggleCheck, setToggleCheck] =useState(false);` <input type="checkbox" id={"layout_toggle"} defaultChecked={toggleCh ...

Attempting to grasp the concept of Promises in Angular 2

I have encountered an issue while working with the Google API service and I am stuck at the promise response stage. Here is the code snippet for reference: getPromise: Promise<any>; loadSheets: Array<any>; constructor(public _checkAuthApiServ ...

Tips for utilizing a private GitLab repository as an npm dependency with a private token via https

I am attempting to incorporate a private GitLab repository as an npm dependency in my node.js application using a private token key. My configuration looks something like this: "dependencies": { "my-module": "git+https://<privateToken>:x-oauth- ...

What are the best methods for capturing individual and time-sensitive occurrences within a service?

I am currently working on structuring the events within a service to enable a mechanism for subscribing/unsubscribing listeners when a controller's scope is terminated. Previously, I utilized $rootScope.$on in this manner: if(!$rootScope.$$listeners[& ...

Incorporating a JavaScript variable into an inline HTML onclick event

Having trouble passing a variable into an inline onclick function. I've tried researching and following suggestions from this link, but encountered errors (Uncaught SyntaxError: missing ) after argument list): pass string parameter in an onclick func ...

"Utilizing Vue.js to dynamically fill input fields based on the selection of an element

As I am still new to learning Vue.js, I may not be using the correct terminology here. My current project involves a basic Vue application where I have implemented a simple search box functionality. The search box triggers an event (v-on:blur) when text i ...

Modify background color when a column is clicked in a dynamically filled table

I'm in the process of dynamically generating an HTML table as shown below: for (var i = 0; i < rowsToAdd; i++) { var tr = table.insertRow(-1); var colsToAddLength = findColsToAddLength(); for (var j = 0; j < colsToAddLength; j++) { ...

"Exploring the implementation of mute event in Audio HTML5 using JavaScript within an MVC

I am searching for an event that triggers when the mute button is pressed. The volumechange event only works when the volume is adjusted. <audio id="volumeController" onvolumechange="changeVolume()"controls> <source src="~/Sounds/be ...

JavaScript errors due to miscalculations Incorrect calculations lead

Here is the formula I am using in my Javascript code: total = parseFloat(unit * rate) + parseFloat(rateamount) + parseFloat(((unit * rate) + (rateamount)) * (tax/100)); The values for the variables are as follows: unit = 5, ra ...

Discover and update values in JSON using JavaScript

Currently, I am working on generating graphs using d3.js with a JSON file as the input. My main challenge lies in parsing the date and time format for the x-axis. Below is the code snippet that I have attempted: d3.json('data/fake_users11.json', ...

Multer is not recognizing the uploaded file and is returning req.file

This question has definitely been asked multiple times in the past, and I have attempted to implement various solutions without much success. Struggling to upload a file and read its size through Node has left me frustrated. Initially, I tried using the f ...

What is the process of using JavaScript code to read a text file?

Trying to use Google Charts while reading data from a text file. The code in JS is written for this purpose: function readTextFile(file){ var rawFile = new XMLHttpRequest(); rawFile.open("GET", file, false); // using synchronous call var allTe ...

The Vue warning states that the property "$store" was attempted to be accessed during rendering, but it is not defined on the current instance

Hello, I am new to the world of web development and currently working on an online shop project. I have encountered two errors that I'm struggling to fix: 1) [Vue warn]: Property "$store" was accessed during render but is not defined on instance. 2) ...

Looking for the most effective method to clean up unused npm and composer packages in your Laravel project?

I have taken over a Laravel project that was created by someone else. They did not utilize Laravel Mix and instead wrote custom JavaScript and CSS files manually. I noticed there are some packages in the composer.json and packages.json files that are no ...

JavaScript file does not execute onload function

Whenever I try to execute the window.onload function from my .js file, it seems to not be firing as expected. <script type="text/javascript" src="{% static 'jsfile.js' %}"></script> window.onload = function() { alert(' ...

What is the best way to swap overlapping elements using CSS transitions?

Imagine this scenario: I have four different elements overlapping within a parent element, structured like so: <body class="one"> <div id="overlapping"> <div class="one">1</div> <div class="two">2</div& ...

Refining checkboxes with specific criteria

I am struggling with the following code: <form method="post"> <% for(let i = 0; i < websites.length; i++){ let website = websites[i]; %> <fieldset id="site<%= i %>" style="padding-bottom: 0; padding-top: 10p ...