@gossi/config-stylelint

中文文档
1.1.5发布于 2026/10/25ES Module构建来源已验证近 30 天下载 4733
原始使用文档
文档目录4 节
  1. Installation
  2. Configuration
  3. Extension
  4. Usage in vscode

@gossi/config-stylelint

Adds stylelint to your packages.

Installation

  1. Install these packages:

    pnpm add -D @gossi/config-stylelint stylelint
    
  2. Create stylelint.config.(m)js config file with these contents:

    export { default } from '@gossi/config-stylelint';
    

    Note: The .mjs extension is for CJS packages, the .js extension for packages with "type": "module".

  3. Add scripts to execute linting

    {
      "scripts": {
        "lint:css": "stylelint \"path/to/css/**/*.css\" --allow-empty-input --cache",
        "lint:css:fix": "stylelint \"path/to/css/**/*.css\" --allow-empty-input --fix"
      }
    }
    

Configuration

@gossi/config-stylelint provides a little configuration option (for target browsers), change your stylelint.config.(m)js to use this:

import { browsers } from 'path/to/your/browsers/config';

import { configure } from '@gossi/config-stylelint';

export default configure({ browsers });

Extension

To extend your configuration with more rules, here is how to do that in your stylelint.config.(m)js:

import config from '@gossi/config-stylelint';

export default {
  ...config,
  rules: {
    ...config.rules,
    'function-no-unknown': [
      true,
      {
        ignoreFunctions: ['$']
      }
    ]
  }
};

this also works with configuring @gossi/config-stylelint:

import { browsers } from 'path/to/your/browsers/config';

import { configure } from '@gossi/config-stylelint';

const config = configure({ browsers });

export default {
  ...config,
  rules: {
    ...config.rules,
    'function-no-unknown': [
      true,
      {
        ignoreFunctions: ['$']
      }
    ]
  }
};

Usage in vscode

Recommend the official stylelint extension (refer for more options).

If the extension can't find stylelint.config.(m)js on its own, configure it per repo, create or edit .vscode/settings.json (if this is a monorepo, then in the root is fine enough for all packages):

{
  "stylelint.configFile": "path/to/stylelint.config.(m)js",
  "stylelint.configBasedir": "path/to/",
  "stylelint.packageManager": "pnpm"
}

版本与发布记录

@gossi/config-stylelint 共发布 28 个版本,首次发布于 2022/08/07;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.1.5latest2026/10/2523 天前
1.1.42026/06/155 个月前
1.1.32026/04/017 个月前
1.1.22026/01/1610 个月前
1.1.12025/10/221.1 年前
1.1.02025/07/131.3 年前

关于 @gossi/config-stylelint 的常见问题

如何安装 @gossi/config-stylelint?

在项目目录运行 npm install @gossi/config-stylelint,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:stylelint(^17.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gossi/config-stylelint 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/gossi__config-stylelint 是否存在。

@gossi/config-stylelint 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@gossi/config-stylelint 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@gossi/config-stylelint 可以商用吗?

@gossi/config-stylelint 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@gossi/config-stylelint 的下载量有多少?

根据 npm 官方下载统计,@gossi/config-stylelint 在 2026/10/17 – 2026/11/15 这 30 天内被下载 4,733 次,日均约 158 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gossi/config-stylelint 还在维护吗?

最新版本 1.1.5 发布于 2026/10/25(23 天前);至今共发布 28 个版本,其中过去 12 个月发布了 4 个;首次发布于 2022/08/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。