M1n01 / ft_transcendence

0 stars 0 forks source link

環境構築 #1

Open M1n01 opened 3 weeks ago

M1n01 commented 3 weeks ago

各環境構築

Frontend

Backend

tools

Database

Blockchain

その他

M1n01 commented 3 weeks ago

~ESLintが使えなさそうなので、~ ESLintとvscodeの拡張機能Prettierを使いましょう。

6/16追記 node.jsをフレームワークと勘違いしており、npmを使用できないものだと勘違いしてました。 こちらの記事によると両方使用した方がいいようです。

M1n01 commented 2 weeks ago

javascriptのフォーマッター、ESLintの設定ファイル(.prettierrc.json, eslint.config.cjs)を作成しました。

以下のコマンドを実行し、ESLintとPrettier、Blackの拡張機能を入れてください。

$ npm install

コマンドでgit commit -m "<commit message>"とすると、ESLintが動作します。(しなかったら教えてください)。 VS Codeのコミット機能からの方法は分からなかったので、あれば教えてください!

もし分からないことや足りないことがあれば聞いてください!!

hsano333 commented 2 weeks ago

スクリーンショット 2024-06-25 022759 対応ありがとうございます

ESLintとPrettier、Blackの拡張機能を入れてください。

これはVS Codeの拡張機能として入れればいいですか?

git commit -m ""とすると、ESLintが動作します

ESLintが動作した結果どうなるのが正常ですか?

いろいろと触ってみたところ、動いているかどうかはちょっと怪しいです・・・ その理由はちょっと長くなりますが書き出します

  1.  eslint.config.cjsファイル内で示しているincludeは指定してディレクトリ内のファイルをeslintでテストするという意味だと思いますが、これを変更しても反応しない(現状srcディレクトリは存在しないため、該当ディレクトリ名に変更したが反応がなかった)
  2. 上記結果を受けて、あらためてsrcディレクトリを作成し、その中に成果物全てをいれてgit commitするとeslint.config.cjs上のエラーが表示される(下記参照)。

`sano@webserv:~/work/42/ft_transcendence/ft_transcendence$ git commit -m "te" ✔ Preparing lint-staged... ⚠ Running tasks for staged files... ❯ package.json — 1 file ❯ src/*/.{js,jsx} — 1 file ✔ prettier --write --loglevel=error ✖ eslint --fix --quiet [FAILED] ↓ {public,src}/*/.{html,gql,graphql,json} — no files ↓ Skipped because of errors from tasks. ✔ Reverting to original state because of errors... ✔ Cleaning up temporary files...

✖ eslint --fix --quiet:

Oops! Something went wrong! :(

ESLint: 9.5.0

A config object is using the "extends" key, which is not supported in flat config system.

Instead of "extends", you can include config objects that you'd like to extend from directly in the flat config array.

If you're using "extends" in your config file, please see the following: https://eslint.org/docs/latest/use/configure/migration-guide#predefined-and-shareable-configs

If you're not using "extends" directly (it may be coming from a plugin), please see the following: https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config`

  1. eslint.config.cjsファイルを簡略化して以下のようにすると、eslintが正常に実行されて、いろいろとコード上のエラーが表示される(添付ファイル参照)。 module.exports = { rules: { indent: ['error', 2], quotes: ['error', 'single'], }, };

おそらく、eslint.config.cjsの何かが原因でエラーになり、実行されていません