もやぶろ

moyashidaisukeのブログだからもやぶろ。フリーランスのエンジニアのダイスケです。QOLあげて色々楽しくチャレンジして良く生きたい。プログラム関連とかギター関連とか旅行関連とか色々。

【javascript】【vue】 create-nuxt-appした後「No rules found within configuration. Have you provided a "rules" property?」エラー

create-nuxt-appした後に、yarn run dev したら「No rules found within configuration. Have you provided a "rules" property?」エラーでビルドができなかったのを解決しました。

事象

create-nuxt-app hogehoge
yarn run dev

create-nuxt-appで作ったプロジェクトに対して(stylelintを使う事を選択)、早速ビルドして動かそうと思ったらエラーが発生しました。 stylelintのエラーです。

 ERROR  Failed to compile with 1 errors                           friendly-errors 13:29:05


 ERROR  StylelintError                                            friendly-errors 13:29:05

No rules found within configuration. Have you provided a "rules" property?

対応

変更前(デフォルト)

module.exports = {
  // add your custom config here
  // https://stylelint.io/user-guide/configuration
};

変更後

module.exports = {
  // add your custom config here
  // https://stylelint.io/user-guide/configuration
  rules: {},
};

メッセージの通り、rulesを中身は空でも良いので設定したら、解決しました。

原因

ここ。 create-nuxt-app/_stylelint.config.js at v2.12.0 · nuxt/create-nuxt-app · GitHub

なのですが、masterブランチでは解消済なので、次のリリースで解消されると思われます。

create-nuxt-app/_stylelint.config.js at master · nuxt/create-nuxt-app · GitHub

その他調べたページ

Error: No rules found within configuration · Issue #607 · stylelint/stylelint · GitHub

vue.js - I have a problem with the initial configuration of Nuxtjs - Stack Overflow

nuxtjsの最初でつまずいた。 | SEとDIY