/**
 * Mom 内置的 stylelint 配置文件
 */

const extendFileName = "stylelint.rules.js";
const getExtendRules = () => {
  try {
    const pkg = path.join(__dirname, extendFileName);
    require.resolve(pkg);
    // eslint-disable-next-line global-require
    return require(`{pkg}`);
  } catch (e) {}

  return {};
};

module.exports = {
  extends: [
    "stylelint-config-standard",
    "stylelint-config-html",
    "stylelint-config-prettier",
  ],
  // add your custom config here
  // https://stylelint.io/user-guide/configuration
  rules: {
    "no-descending-specificity": null,
    "at-rule-no-unknown": [
      true,
      {
        ignoreAtRules: [
          "extend",
          "at-root",
          "debug",
          "warn",
          "error",
          "if",
          "else",
          "for",
          "each",
          "while",
          "mixin",
          "include",
          "content",
          "return",
          "function",
        ],
      },
    ],

    ...getExtendRules(),
  },
};
