diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 19739d9..28bee0a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,3 +21,5 @@ jobs: steps: - uses: actions/checkout@v3 - uses: dprint/check@v2.2 + with: + config-path: 'dprint-ci.json' diff --git a/.vscode/extensions.json b/.vscode/extensions.json index c2933f7..fd442e8 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -7,7 +7,6 @@ "koichisasada.vscode-rdbg", "soutaro.steep-vscode", "soutaro.rbs-syntax", - "rebornix.ruby", "jnoortheen.nix-ide" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index fd0cfc6..a4dd07e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,14 +1,6 @@ { "editor.formatOnSave": true, "editor.defaultFormatter": "dprint.dprint", - "ruby.useBundler": true, // run non-lint commands with bundle exec - "ruby.useLanguageServer": true, // use the internal language server (see below) - "ruby.lint": { - "rubocop": { - "useBundler": true // enable rubocop via bundler - } - }, - "ruby.format": "rubocop", // use rubocop for formatting "cSpell.words": [ "dprint" ] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0fdc637..e6dc07a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,6 +19,37 @@ $ dprint --version $ bundle install || bundle update ``` +## Dprint + +Use dprint as below + +```console +$ dprint --config dprint-ci.json check +$ dprint --config dprint-ci.json fmt +``` + +Providing 2 config files. For the purpose below + +- [dprint-ci.json](dprint-ci.json) - Except ruby for faster run +- [dprint.json](dprint.json) - Includes rubocop integration. Just using in vscode + +## Rubocop + +Using rubocop as a formatter. So recommend to execute it with servermode before editting code to reduce time. + +```console +$ bundle exec rubocop --start-server +``` + +Vscode tasks does not include it because of executed server process will exists even after closing vscode.\ +Please manually kill it as below. + +```console +$ bundle exec rubocop --stop-server +``` + +See [microsoft/vscode#65986](https://github.com/microsoft/vscode/issues/65986) for further detail. + ## Feel the latest version with REPL ```console diff --git a/dprint-ci.json b/dprint-ci.json new file mode 100644 index 0000000..880b37b --- /dev/null +++ b/dprint-ci.json @@ -0,0 +1,22 @@ +{ + "json": { + }, + "markdown": { + }, + "prettier": { + "printWidth": 120, + "singleQuote": true + }, + "includes": ["**/*.{json,md,yml,html,css}"], + "excludes": [ + ".git", + "**/*-lock.json", + "doc" + ], + "plugins": [ + "https://plugins.dprint.dev/json-0.17.0.wasm", + "https://plugins.dprint.dev/markdown-0.15.2.wasm", + "https://plugins.dprint.dev/exec-0.3.5.json@d687dda57be0fe9a0088ccdaefa5147649ff24127d8b3ea227536c68ee7abeab", + "https://plugins.dprint.dev/prettier-0.17.0.json@5e42cbabab9906ad32ffe1aa67f15824b1c39408840f0afeaddc495dd362e177" + ] +} diff --git a/dprint.json b/dprint.json index acb6957..37bd17e 100644 --- a/dprint.json +++ b/dprint.json @@ -1,21 +1,15 @@ { - "json": { + "extends": "dprint-ci.json", + "exec": { + "associations": ["**/*.{rb,gemspec,rake}", "Rakefile", "Gemfile", "Steepfile"], + "rubocop": "bundle exec rubocop --autocorrect --stdin {{file_path}} --stderr", + "rubocop.associations": "**/**" }, - "markdown": { - }, - "prettier": { - "printWidth": 120, - "singleQuote": true - }, - "includes": ["**/*.{json,md,yml,html,css}"], + "includes": ["**/*.{json,md,yml,html,css,rb,gemspec,rake}", "{Rakefile,Gemfile,Steepfile}"], "excludes": [ ".git", - "**/*-lock.json", - "doc" - ], - "plugins": [ - "https://plugins.dprint.dev/json-0.17.0.wasm", - "https://plugins.dprint.dev/markdown-0.15.2.wasm", - "https://plugins.dprint.dev/prettier-0.17.0.json@5e42cbabab9906ad32ffe1aa67f15824b1c39408840f0afeaddc495dd362e177" + "**/*lock.json", + "doc", + "steep_expectations.yml" ] }