js_rails_routes 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd2383225d89dcc53076b7dd12b2600c09659dae5ddee39e7da9dd2f7d8d09dd
4
- data.tar.gz: a9162a939abd31bd7fe552255846caf6a4ffbcf1ba80737e058bfe868ca2b4c0
3
+ metadata.gz: c11d8e6af1565c2c53a41fae11b7f802862abdc0fdf025d91c55b06718b69f42
4
+ data.tar.gz: 44d767c56274bf63c53d241dfd84feb1f2bac1e56f59e68d8b28ff3e6852ec98
5
5
  SHA512:
6
- metadata.gz: 1c900ddad4563c435937edba1c072a299438a80290b6cd77b48f2a00493c37919a987606ed7c8a7784480dcbfd2a85c52f9ce50f59b5896914165ea6bd5d1255
7
- data.tar.gz: c27c9ce37e7d8de9031cdc13ff2c412c4ecc627f54183f67a478dd99d5dde4dde7e6c444320c7794a2e03156af22bb3c0a82b7293a359c37b33e50e4c9bd1e14
6
+ metadata.gz: ba97b9bb129f473f3c50fb5bd4fc5804c95c77ae48a5acf34d6b02dd8fe5f8250af895915f3d834feb69a7878d3e01bb376fec2b6b85c4f1ca93d6c831e687bc
7
+ data.tar.gz: 9ad1938f061504f09dd194e991a352dcee227d07f6a6be2cfc633ed6b558386898e71fae6345f4a58c2622092a4a93dc2b2ea4f7cc37846a84a4c4039b40fb46
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ This change log adheres to [keepachangelog.com](http://keepachangelog.com).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.1.0] - 2024-02-09
10
+ ### Changed
11
+ - Add eslint-disable comment not to affect eslint format
12
+ - Update generated scripts to adopt eslint rule
13
+
9
14
  ## [1.0.0] - 2022-05-13
10
15
 
11
16
  ### Changed
data/README.md CHANGED
@@ -38,7 +38,7 @@ then `rake js:routes` generates "app/assets/javascripts/rails-routes.js" as:
38
38
  // Don't edit manually. `rake js:routes` generates this file.
39
39
  function process(route, params, keys) {
40
40
  var query = [];
41
- for (var param in params) if (params.hasOwnProperty(param)) {
41
+ for (var param in params) if (Object.prototype.hasOwnProperty.call(params, param)) {
42
42
  if (keys.indexOf(param) === -1) {
43
43
  query.push(param + "=" + encodeURIComponent(params[param]));
44
44
  }
@@ -17,7 +17,11 @@ module JSRailsRoutes
17
17
  def generate(task)
18
18
  builder.build.each do |artifact|
19
19
  file_name = File.join(config.output_dir, artifact.file_name)
20
- file_body = "// Don't edit manually. `rake #{task}` generates this file.\n#{artifact.body}"
20
+ file_body = <<~FILE_BODY.chomp
21
+ /* eslint-disable */
22
+ // Don't edit manually. `rake #{task}` generates this file.
23
+ #{artifact.body}
24
+ FILE_BODY
21
25
  writable.write(file_name, file_body)
22
26
  end
23
27
  end
@@ -9,7 +9,7 @@ module JSRailsRoutes
9
9
  PROCESS_FUNC = <<~JAVASCRIPT
10
10
  function process(route, params, keys) {
11
11
  var query = [];
12
- for (var param in params) if (params.hasOwnProperty(param)) {
12
+ for (var param in params) if (Object.prototype.hasOwnProperty.call(params, param)) {
13
13
  if (keys.indexOf(param) === -1) {
14
14
  query.push(param + "=" + encodeURIComponent(params[param]));
15
15
  }
@@ -12,7 +12,7 @@ module JSRailsRoutes
12
12
  function process(route: string, params: Record<string, Value> | undefined, keys: string[]): string {
13
13
  if (!params) return route
14
14
  var query: string[] = [];
15
- for (var param in params) if (params.hasOwnProperty(param)) {
15
+ for (var param in params) if (Object.prototype.hasOwnProperty.call(params, param)) {
16
16
  if (keys.indexOf(param) === -1) {
17
17
  query.push(param + "=" + encodeURIComponent(params[param].toString()));
18
18
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSRailsRoutes
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -12,7 +12,7 @@ RSpec.describe JSRailsRoutes::Language::JavaScript do
12
12
  expect(subject).to eq <<~JAVASCRIPT
13
13
  function process(route, params, keys) {
14
14
  var query = [];
15
- for (var param in params) if (params.hasOwnProperty(param)) {
15
+ for (var param in params) if (Object.prototype.hasOwnProperty.call(params, param)) {
16
16
  if (keys.indexOf(param) === -1) {
17
17
  query.push(param + "=" + encodeURIComponent(params[param]));
18
18
  }
@@ -15,7 +15,7 @@ RSpec.describe JSRailsRoutes::Language::TypeScript do
15
15
  function process(route: string, params: Record<string, Value> | undefined, keys: string[]): string {
16
16
  if (!params) return route
17
17
  var query: string[] = [];
18
- for (var param in params) if (params.hasOwnProperty(param)) {
18
+ for (var param in params) if (Object.prototype.hasOwnProperty.call(params, param)) {
19
19
  if (keys.indexOf(param) === -1) {
20
20
  query.push(param + "=" + encodeURIComponent(params[param].toString()));
21
21
  }
@@ -42,6 +42,7 @@ RSpec.describe JSRailsRoutes do
42
42
  subject
43
43
 
44
44
  expect(File.read(app_root.join('app/assets/javascripts/rails-routes.js'))).to eq <<~JAVASCRIPT
45
+ /* eslint-disable */
45
46
  // Don't edit manually. `rake #{task}` generates this file.
46
47
  #{JSRailsRoutes::Language::JavaScript::PROCESS_FUNC}
47
48
  export function blogs_path(params) { return process('/blogs', params, []); }
@@ -55,6 +56,7 @@ RSpec.describe JSRailsRoutes do
55
56
  JAVASCRIPT
56
57
 
57
58
  expect(File.read(app_root.join('app/assets/javascripts/admin-routes.js'))).to eq <<~JAVASCRIPT
59
+ /* eslint-disable */
58
60
  // Don't edit manually. `rake #{task}` generates this file.
59
61
  #{JSRailsRoutes::Language::JavaScript::PROCESS_FUNC}
60
62
  export function notes_path(params) { return process('/notes', params, []); }
@@ -94,6 +96,7 @@ RSpec.describe JSRailsRoutes do
94
96
  subject
95
97
 
96
98
  expect(File.read(app_root.join('app/assets/javascripts/rails-routes.ts'))).to eq <<~TYPESCRIPT
99
+ /* eslint-disable */
97
100
  // Don't edit manually. `rake #{task}` generates this file.
98
101
  #{JSRailsRoutes::Language::TypeScript::PROCESS_FUNC}
99
102
  export function blogs_path(params?: Record<string, Value>) { return process('/blogs', params, []); }
@@ -107,6 +110,7 @@ RSpec.describe JSRailsRoutes do
107
110
  TYPESCRIPT
108
111
 
109
112
  expect(File.read(app_root.join('app/assets/javascripts/admin-routes.ts'))).to eq <<~TYPESCRIPT
113
+ /* eslint-disable */
110
114
  // Don't edit manually. `rake #{task}` generates this file.
111
115
  #{JSRailsRoutes::Language::TypeScript::PROCESS_FUNC}
112
116
  export function notes_path(params?: Record<string, Value>) { return process('/notes', params, []); }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js_rails_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Qiita Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-13 00:00:00.000000000 Z
11
+ date: 2024-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -170,7 +170,7 @@ dependencies:
170
170
  - - "!="
171
171
  - !ruby/object:Gem::Version
172
172
  version: 0.19.1
173
- description:
173
+ description:
174
174
  email:
175
175
  - engineers@qiita.com
176
176
  executables: []
@@ -219,7 +219,7 @@ licenses:
219
219
  - MIT
220
220
  metadata:
221
221
  rubygems_mfa_required: 'true'
222
- post_install_message:
222
+ post_install_message:
223
223
  rdoc_options: []
224
224
  require_paths:
225
225
  - lib
@@ -234,8 +234,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  - !ruby/object:Gem::Version
235
235
  version: '0'
236
236
  requirements: []
237
- rubygems_version: 3.0.3
238
- signing_key:
237
+ rubygems_version: 3.4.1
238
+ signing_key:
239
239
  specification_version: 4
240
240
  summary: Generate a ES6 module that contains Rails routes.
241
241
  test_files: []