Skip to content

Commit

Permalink
Merge pull request #36 from increments/add-eslint-disable-not-to-affe…
Browse files Browse the repository at this point in the history
…ct-eslint-format

Add eslint-disable comment not to affect eslint format
  • Loading branch information
getty104 committed Feb 8, 2024
2 parents 23d4180 + fc0f583 commit b8840ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/js_rails_routes/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def initialize(builder, writable: File)
def generate(task)
builder.build.each do |artifact|
file_name = File.join(config.output_dir, artifact.file_name)
file_body = "// Don't edit manually. `rake #{task}` generates this file.\n#{artifact.body}"
file_body = <<~FILE_BODY.chomp
/* eslint-disable */
// Don't edit manually. `rake #{task}` generates this file.
#{artifact.body}
FILE_BODY
writable.write(file_name, file_body)
end
end
Expand Down
4 changes: 4 additions & 0 deletions spec/js_rails_routes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
subject

expect(File.read(app_root.join('app/assets/javascripts/rails-routes.js'))).to eq <<~JAVASCRIPT
/* eslint-disable */
// Don't edit manually. `rake #{task}` generates this file.
#{JSRailsRoutes::Language::JavaScript::PROCESS_FUNC}
export function blogs_path(params) { return process('/blogs', params, []); }
Expand All @@ -55,6 +56,7 @@
JAVASCRIPT

expect(File.read(app_root.join('app/assets/javascripts/admin-routes.js'))).to eq <<~JAVASCRIPT
/* eslint-disable */
// Don't edit manually. `rake #{task}` generates this file.
#{JSRailsRoutes::Language::JavaScript::PROCESS_FUNC}
export function notes_path(params) { return process('/notes', params, []); }
Expand Down Expand Up @@ -94,6 +96,7 @@
subject

expect(File.read(app_root.join('app/assets/javascripts/rails-routes.ts'))).to eq <<~TYPESCRIPT
/* eslint-disable */
// Don't edit manually. `rake #{task}` generates this file.
#{JSRailsRoutes::Language::TypeScript::PROCESS_FUNC}
export function blogs_path(params?: Record<string, Value>) { return process('/blogs', params, []); }
Expand All @@ -107,6 +110,7 @@
TYPESCRIPT

expect(File.read(app_root.join('app/assets/javascripts/admin-routes.ts'))).to eq <<~TYPESCRIPT
/* eslint-disable */
// Don't edit manually. `rake #{task}` generates this file.
#{JSRailsRoutes::Language::TypeScript::PROCESS_FUNC}
export function notes_path(params?: Record<string, Value>) { return process('/notes', params, []); }
Expand Down

0 comments on commit b8840ff

Please sign in to comment.