Skip to content

feat(lint): overhaul linting infrastructure#375

Open
merichar wants to merge 12 commits intomasterfrom
lint-infrastructure
Open

feat(lint): overhaul linting infrastructure#375
merichar wants to merge 12 commits intomasterfrom
lint-infrastructure

Conversation

@merichar
Copy link
Member

Summary

  • Add CI workflow (.github/workflows/ci.yml) to enforce lint on PRs and master
  • Add rubocop-minitest for Minitest-specific cops
  • Migrate rubocop extensions from require: to plugins: (new API)
  • Fix prettier.rake bug: --check and --write were both passed in autocorrect mode
  • Fix prettier file discovery: pass '.' instead of explicit FileList so .prettierignore is respected
  • Add .prettierignore to exclude generated/vendor/upstream files
  • Add FinalNewline linter to .erb-lint.yml
  • Upgrade prettier 2.2.1 to 2.8.8 (latest v2); add .npmrc for legacy-peer-deps
  • Add .node-version for CI Node setup

* Add CI workflow (.github/workflows/ci.yml) to enforce lint on PRs and master
* Add rubocop-minitest for Minitest-specific cops
* Migrate rubocop extensions from require: to plugins: (new API)
* Fix prettier.rake bug: --check and --write were both passed in autocorrect mode
* Fix prettier file discovery: pass '.' instead of explicit FileList so .prettierignore is respected
* Add .prettierignore to exclude generated/vendor/upstream files
* Add FinalNewline linter to .erb-lint.yml
* Upgrade prettier 2.2.1 to 2.8.8 (latest v2); add .npmrc for legacy-peer-deps
* Add .node-version for CI Node setup
Pattern rules are not discoverable by bin/rails, only by rake, so
further pattern rules (e.g.: lint:rubocop:dryrun) must be invoked by rake.
* Lint tasks only shell out to rubocop/prettier/erblint/brakeman
  and do not need a booted Rails environment
* Booting Rails triggered a network call to login.cmu.edu in CI,
  causing SocketError on GitHub runners
* Replace Rails.root.join require with require_relative
* Replace ActiveSupport present?/presence with plain Ruby equivalents
* replace prettier@2 + prettier-plugin-erb with prettier@3 +
  @4az/prettier-plugin-html-erb + @prettier/plugin-ruby@4
* update .prettierrc with explicit plugins array and erb-template parser
* remove prettier_print, syntax_tree-haml, syntax_tree-rbs from Gemfile
  (no longer needed by plugin-ruby v4)
* keep syntax_tree gem (plugin-ruby v4 parse server still requires it)
* remove inherit_from rubocop.yml from .rubocop.yml (v4 does not ship it)
* add CONTRIBUTING.md with dev container setup, conventional commits
  guide, branching conventions, and links to linting docs
* add docs/linting.md with full linting reference including tools,
  commands, configuration rationale, and sidebar whitespace gotcha
* update README.md to point to CONTRIBUTING.md
* .prettierrc is prettier's native JSON default
* drop .prettierignore entry that worked around the YAML parse error
* n.b.: sidebar comment moved to docs/linting.md in previous commit
* lint tasks intentionally omit :environment to avoid booting Rails
* booting Rails in CI triggers a network call to login.cmu.edu,
  causing SocketError on GitHub runners
* db/schema.rb is auto-generated; line length violations are not actionable
* config/initializers/new_framework_defaults_7_0.rb is a Rails-generated
  file with intentionally long explanatory comments
* shift_picker.rb is a legacy standalone script pending removal
Rails-generated binstubs in bin/ are not project code and should not be linted.
In CI, bundler installs gems into vendor/bundle. RuboCop scans
into those directories and encounters a gem's .rubocop.yml that
uses inherit_gem: rubocop-discourse, causing MissingSpecError.
Prettier's default for Ruby is double quotes, which conflicts with
RuboCop's Style/StringLiterals preference. Setting rubySingleQuote: true
aligns both tools so they don't fight each other.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant