npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@labnol/js-config

v3.0.0

Published

Shareable ESLint flat config and Prettier config for Google Apps Script, Node.js and React projects, ready for ESLint 10, Vite and Tailwind CSS

Readme

@labnol/js-config

Shared ESLint and Prettier settings for Google Apps Script, Node and React projects. Pick the preset that matches your project and set up each tool with a single line.

Built by Amit Agarwal for Digital Inspiration, where it is used in popular projects like Mail Merge, Document Studio and labnol.org.

What's Included

| Preset | Use it for | What it adds | | ------------------- | ------------------------------ | ------------------------------------------------------------------------------------------ | | eslint/appsscript | Google Apps Script projects | Apps Script globals such as SpreadsheetApp, plus google.script.run and OAuth libraries | | eslint/node | Node.js projects | Node globals and a warning for import cycles | | eslint/react | React apps built with Vite | React, Hooks, React Compiler and Fast Refresh rules | | prettier | Any project | 120-character lines, single quotes, semicolons and LF line endings | | prettier/tailwind | Projects that use Tailwind CSS | The same style, plus sorted Tailwind classes |

Every ESLint preset is an ESLint 10 flat config. It requires ===, blocks nested ternaries, else after return and reassigned parameters, and warns on default exports outside tool configs such as vite.config.js. It sorts imports, lints JSON files, sorts keys in JSON other than package.json, appsscript.json, tsconfig*.json, jsconfig*.json, .clasp.json and .vscode/*.json, and leaves formatting to Prettier.

Install

npm install -D @labnol/js-config

This also installs ESLint, Prettier and the ESLint plugins the presets import, so remove them from the project's own devDependencies. npm links the eslint and prettier commands into the project, so npm run lint works without listing them. pnpm and Yarn don't, so with those, add eslint and prettier to the project too.

Requires Node ^20.19.0, ^22.13.0, or >=24, the same range as ESLint 10.

React Projects

A React project also needs the React plugins and the TypeScript runtime used by @eslint-react/eslint-plugin (even when your source is JavaScript):

npm install -D @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-react-refresh typescript

For Tailwind class sorting, install its optional Prettier plugin separately:

npm install -D prettier-plugin-tailwindcss

No peer-dependency bypass is needed. Remove legacy-peer-deps=true from your project's .npmrc if you added it for an earlier version of this package.

Set up ESLint

Create eslint.config.mjs in the project root with one line. The .mjs extension works in both CommonJS and ESM projects:

export { default } from '@labnol/js-config/eslint/appsscript';

Change appsscript to node for a Node project or react for a React project.

Override a Rule

To change a rule in one project, import the preset and add your overrides after it:

import appsScript from '@labnol/js-config/eslint/appsscript';

export default [...appsScript, { rules: { 'no-console': 'off' } }];

Node Code in an Apps Script Project

The Apps Script preset has no Node globals, because Apps Script has no process, Buffer, fetch or setTimeout. Tool configs such as vite.config.js still get them. For other code that runs in Node, such as tests, scripts or Cloud Functions, add the globals for those folders:

import appsScript from '@labnol/js-config/eslint/appsscript';
import globals from 'globals';

export default [
  ...appsScript,
  { files: ['scripts/**/*.js', '**/*.test.js'], languageOptions: { globals: globals.node } },
];

Apps Script Entry Points

The default Apps Script preset supports bundled ESM source. For files deployed directly to Apps Script, use script mode and declare functions called by triggers, custom menus, or google.script.run with an exported comment:

import appsScript from '@labnol/js-config/eslint/appsscript';

export default [...appsScript, { files: ['Code.js'], languageOptions: { sourceType: 'script' } }];

In Code.js:

/* exported onOpen, doGet */
function onOpen() {
  SpreadsheetApp.getUi();
}

function doGet() {
  return HtmlService.createHtmlOutput('Hello');
}

List your own callable functions in the comment and adjust the file pattern to match your script files. Unused local variables and unlisted functions are still checked. The exported comment only applies in script mode; bundled modules should use normal JavaScript exports.

Apps Script source has Apps Script globals, while *.config.js, *.config.mjs, and *.config.cjs files have Node globals. Node-only APIs such as process and Buffer are reported in Apps Script source.

React Version

The React preset targets React 19. For a React 18 app, set the version after the preset:

import react from '@labnol/js-config/eslint/react';

export default [...react, { settings: { 'react-x': { version: '18' } } }];

React rules apply to JavaScript and JSX files, leaving JSON to the JSON rules. Browser source does not include Node's process global; use Vite's import.meta.env for environment variables. Tool configuration files retain Node globals.

Migrating from 1.x or 2.x

Version 3 replaces the React lint plugin and changes several rule names. Remove eslint-plugin-react from your project (npm uninstall eslint-plugin-react), replace it with @eslint-react/eslint-plugin and install typescript using the React install command above. Remove the old eslint-plugin-react entry from overrides if your project added it for ESLint 10 compatibility. The official Hooks, Compiler, and Fast Refresh plugins remain in use.

Update project-specific overrides to the new rule names:

| Previous rule | Replacement | | ----------------------------------------- | ----------------------------------------------- | | react/jsx-key | @eslint-react/no-missing-key | | react/no-array-index-key | @eslint-react/no-array-index-key | | react/no-unstable-nested-components | @eslint-react/no-nested-component-definitions | | react/jsx-no-constructed-context-values | @eslint-react/no-unstable-context-value | | react/hook-use-state | @eslint-react/use-state | | react/button-has-type | @eslint-react/dom-no-missing-button-type |

The new recommended React checks differ from the old plugin's checks. Function declarations and arrow functions are both accepted as components. The old JSX style rules (boolean props, curly braces, fragments, and self-closing tags) are no longer enforced by this preset. Change React version overrides from settings.react.version to settings['react-x'].version.

For projects upgrading from 1.x, the Apps Script preset rejects Node-only globals in application source. Mark directly deployed script entry points as described above. CommonJS .cjs files retain CommonJS parsing, including top-level returns.

Set up Prettier

Delete the project's .prettierrc and add one line to package.json:

"prettier": "@labnol/js-config/prettier"

For a project that uses Tailwind, add /tailwind to the end. Prettier then also sorts the Tailwind classes in your markup:

"prettier": "@labnol/js-config/prettier/tailwind"

This needs prettier-plugin-tailwindcss in the project, which the Install step covers.

Development Checks

npm ci
npm test
npm run lint
npm run format:check
npm run test:consumer -- npm

The consumer check packs the package, installs it outside the repository, and verifies all five public exports and CLI access. It checks a minimal install without optional plugins and a full install with React and Tailwind. It needs network access to install dependencies and removes its temporary projects afterward.

Use npm run test:consumer -- pnpm or npm run test:consumer -- yarn to test pnpm or Yarn Classic. Install the corresponding package manager first. CI runs unit checks across Node 20.19, 22.13, 24, and 26, and consumer checks with npm, pnpm 10, and Yarn Classic on Node 24.

Publish an Update

  1. Commit your change, then run:

    npm version patch

    Use patch for a fix, minor for a new rule, or major for a change that flags existing code. The command runs the tests and the linter, bumps the version and pushes the commit and tag to GitHub. The tag starts a GitHub Action that publishes the new version to npm within a few minutes.

  2. In each project, install the new version:

    npm install -D @labnol/js-config@latest