Skip to content

Commit 07afcb7

Browse files
committed
rubocop --only Style/StringLiterals -a
1 parent 0f75fe7 commit 07afcb7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+306
-306
lines changed

Appraisals

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,97 @@
1-
appraise "rails-3.2" do
1+
appraise 'rails-3.2' do
22
gem 'rails', '~> 3.2.21'
33
gem 'rack-cache', '~> 1.6.1'
44
# Modern turbolinks depends on `Rails.application.assets` which no-worky
55
gem 'turbolinks', '~> 2.0'
66
end
77

8-
appraise "rails-4.0.5" do
8+
appraise 'rails-4.0.5' do
99
# Depends on sprockets-rails ~> 2.0.0. Support for
1010
# `Rails.application.assets_manifest` which is used by
1111
# `ServerRendering::ManifestContainer` has only been added in
1212
# sprockets-rails 2.2.2. Ensure that server rendering falls back to
1313
# `ServerRendering::EnvironmentContainer`.`
1414
gem 'rails', '4.0.5'
15-
gem "turbolinks"
15+
gem 'turbolinks'
1616
end
1717

18-
appraise "rails-4.0-with-therubyracer" do
18+
appraise 'rails-4.0-with-therubyracer' do
1919
gem 'rails', '~> 4.0.13'
2020
gem 'therubyracer', '0.12.0', :platform => :mri
21-
gem "turbolinks"
21+
gem 'turbolinks'
2222
end
2323

24-
appraise "rails-4.1" do
24+
appraise 'rails-4.1' do
2525
gem 'rails', '~> 4.1.10'
2626
# Just to make sure we support old Turbolinks:
27-
gem "turbolinks", "~> 2.3.0"
27+
gem 'turbolinks', '~> 2.3.0'
2828
end
2929

30-
appraise "rails-4.2-sprockets_2" do
30+
appraise 'rails-4.2-sprockets_2' do
3131
gem 'rails', '~> 4.2.1'
32-
gem "sprockets", "~> 2.12"
33-
gem "turbolinks"
32+
gem 'sprockets', '~> 2.12'
33+
gem 'turbolinks'
3434
end
3535

36-
appraise "rails-4.2-sprockets_3" do
36+
appraise 'rails-4.2-sprockets_3' do
3737
gem 'rails', '~> 4.2.1'
38-
gem "sprockets", "~> 3.5"
39-
gem "turbolinks", "~> 2.5.0"
38+
gem 'sprockets', '~> 3.5'
39+
gem 'turbolinks', '~> 2.5.0'
4040
end
4141

42-
appraise "rails-4.2-sprockets_4" do
42+
appraise 'rails-4.2-sprockets_4' do
4343
gem 'rails', '~> 4.2.1'
44-
gem "sprockets", "~> 4.0.x"
45-
gem "turbolinks", "~> 2.5.0"
44+
gem 'sprockets', '~> 4.0.x'
45+
gem 'turbolinks', '~> 2.5.0'
4646
# This ExecJS backend provides stateful context
4747
# which the default nodejs backend does not
48-
gem "mini_racer"
48+
gem 'mini_racer'
4949
end
5050

5151
# no_sprockets is a magical name from sprockets_helper.rb in test to
5252
# load in certain tests or not.
53-
appraise "rails-5_no_sprockets_webpacker_1_1" do
53+
appraise 'rails-5_no_sprockets_webpacker_1_1' do
5454
gem 'rails', '~> 5.0.0'
55-
gem "webpacker", '~> 1.1.0'
55+
gem 'webpacker', '~> 1.1.0'
5656
# This ExecJS backend provides stateful context
5757
# which the default nodejs backend does not
58-
gem "therubyracer"
58+
gem 'therubyracer'
5959
end
6060

61-
appraise "rails-5_no_sprockets_webpacker_1_x" do
61+
appraise 'rails-5_no_sprockets_webpacker_1_x' do
6262
gem 'rails', '~> 5.0.0'
63-
gem "webpacker", '~> 1.2'
63+
gem 'webpacker', '~> 1.2'
6464
# This ExecJS backend provides stateful context
6565
# which the default nodejs backend does not
66-
gem "therubyracer"
66+
gem 'therubyracer'
6767
end
6868

69-
appraise "rails-5_no_sprockets_webpacker_2" do
69+
appraise 'rails-5_no_sprockets_webpacker_2' do
7070
gem 'rails', '~> 5.0.0'
71-
gem "webpacker", '~> 2.0'
71+
gem 'webpacker', '~> 2.0'
7272
# This ExecJS backend provides stateful context
7373
# which the default nodejs backend does not
74-
gem "therubyracer"
74+
gem 'therubyracer'
7575
end
7676

77-
appraise "rails-5_no_sprockets_webpacker_3" do
77+
appraise 'rails-5_no_sprockets_webpacker_3' do
7878
gem 'rails', '~> 5.0.0'
7979
gem 'webpacker', '>= 3.0'
8080
# This ExecJS backend provides stateful context
8181
# which the default nodejs backend does not
82-
gem "therubyracer"
82+
gem 'therubyracer'
8383
end
8484

85-
appraise "rails-5-no_sprockets" do
85+
appraise 'rails-5-no_sprockets' do
8686
# Appraisal adds `turbolinks` to this gemfile because it is
8787
# present in `./Gemfile`.
8888
# But it causes this gemfile to break, so it must be removed
8989
# from `./gemfiles/rails_5_no_sprockets.gemfile` manually.
9090
gem 'rails', '~> 5.0.0'
9191
end
9292

93-
appraise "rails-5.1-sprockets_4" do
94-
gem "rails", "~> 5.1"
95-
gem "sprockets", "~> 4.0.x"
96-
gem "turbolinks", "~> 5.0.0"
93+
appraise 'rails-5.1-sprockets_4' do
94+
gem 'rails', '~> 5.1'
95+
gem 'sprockets', '~> 4.0.x'
96+
gem 'turbolinks', '~> 5.0.0'
9797
end

Rakefile

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ def yarn_run_in(dirname, cmd)
2020
end
2121

2222
namespace :react do
23-
desc "Run the JS build process to put files in the gem source"
23+
desc 'Run the JS build process to put files in the gem source'
2424
task update: [:install, :build, :copy]
2525

26-
desc "Build the JS bundles with Webpack"
26+
desc 'Build the JS bundles with Webpack'
2727
task :build do
28-
yarn_run_in("react-builds", "build")
28+
yarn_run_in('react-builds', 'build')
2929
end
3030

3131
desc "Copy browser-ready JS files to the gem's asset paths"
3232
task :copy do
33-
environments = ["development", "production"]
33+
environments = ['development', 'production']
3434
environments.each do |environment|
3535
# Without addons:
3636
copy_react_asset("#{environment}/react-browser.js", "#{environment}/react.js")
@@ -42,37 +42,37 @@ namespace :react do
4242
end
4343
end
4444

45-
desc "Install the JavaScript dependencies"
45+
desc 'Install the JavaScript dependencies'
4646
task :install do
47-
yarn_run_in("react-builds", "upgrade")
47+
yarn_run_in('react-builds', 'upgrade')
4848
end
4949
end
5050

5151
namespace :ujs do
52-
desc "Run the JS build process to put files in the gem source"
52+
desc 'Run the JS build process to put files in the gem source'
5353
task update: [:install, :build, :copy]
5454

55-
desc "Install the JavaScript dependencies"
55+
desc 'Install the JavaScript dependencies'
5656
task :install do
57-
yarn_run_in("react_ujs", "upgrade")
57+
yarn_run_in('react_ujs', 'upgrade')
5858
end
5959

6060

61-
desc "Build the JS bundles with Webpack"
61+
desc 'Build the JS bundles with Webpack'
6262
task :build do
63-
yarn_run_in("react_ujs", "build")
63+
yarn_run_in('react_ujs', 'build')
6464
end
6565

6666
desc "Copy browser-ready JS files to the gem's asset paths"
6767
task :copy do
68-
full_webpack_path = File.expand_path("../react_ujs/dist/react_ujs.js", __FILE__)
69-
full_destination_path = File.expand_path("../lib/assets/javascripts/react_ujs.js", __FILE__)
68+
full_webpack_path = File.expand_path('../react_ujs/dist/react_ujs.js', __FILE__)
69+
full_destination_path = File.expand_path('../lib/assets/javascripts/react_ujs.js', __FILE__)
7070
FileUtils.cp(full_webpack_path, full_destination_path)
7171
end
7272

73-
desc "Publish the package in ./react_ujs/ to npm as `react_ujs`"
73+
desc 'Publish the package in ./react_ujs/ to npm as `react_ujs`'
7474
task publish: :update do
75-
Dir.chdir("react_ujs") do
75+
Dir.chdir('react_ujs') do
7676
`npm publish`
7777
end
7878
end
@@ -92,16 +92,16 @@ end
9292
task default: :test
9393

9494
task :test_setup do
95-
Dir.chdir("./test/dummy_sprockets") do
95+
Dir.chdir('./test/dummy_sprockets') do
9696
`yarn install`
9797
end
98-
Dir.chdir("./test/dummy_webpacker1") do
98+
Dir.chdir('./test/dummy_webpacker1') do
9999
`yarn install`
100100
end
101-
Dir.chdir("./test/dummy_webpacker2") do
101+
Dir.chdir('./test/dummy_webpacker2') do
102102
`yarn install`
103103
end
104-
Dir.chdir("./test/dummy_webpacker3") do
104+
Dir.chdir('./test/dummy_webpacker3') do
105105
`yarn install`
106106
end
107107
end

lib/generators/react/component_generator.rb

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class ComponentGenerator < ::Rails::Generators::NamedBase
4848
argument :attributes,
4949
:type => :array,
5050
:default => [],
51-
:banner => "field[:type] field[:type] ..."
51+
:banner => 'field[:type] field[:type] ...'
5252

5353
class_option :es6,
5454
type: :boolean,
@@ -61,29 +61,29 @@ class ComponentGenerator < ::Rails::Generators::NamedBase
6161
desc: 'Output coffeescript based component'
6262

6363
REACT_PROP_TYPES = {
64-
"node" => 'React.PropTypes.node',
65-
"bool" => 'React.PropTypes.bool',
66-
"boolean" => 'React.PropTypes.bool',
67-
"string" => 'React.PropTypes.string',
68-
"number" => 'React.PropTypes.number',
69-
"object" => 'React.PropTypes.object',
70-
"array" => 'React.PropTypes.array',
71-
"shape" => 'React.PropTypes.shape({})',
72-
"element" => 'React.PropTypes.element',
73-
"func" => 'React.PropTypes.func',
74-
"function" => 'React.PropTypes.func',
75-
"any" => 'React.PropTypes.any',
76-
77-
"instanceOf" => ->(type) {
64+
'node' => 'React.PropTypes.node',
65+
'bool' => 'React.PropTypes.bool',
66+
'boolean' => 'React.PropTypes.bool',
67+
'string' => 'React.PropTypes.string',
68+
'number' => 'React.PropTypes.number',
69+
'object' => 'React.PropTypes.object',
70+
'array' => 'React.PropTypes.array',
71+
'shape' => 'React.PropTypes.shape({})',
72+
'element' => 'React.PropTypes.element',
73+
'func' => 'React.PropTypes.func',
74+
'function' => 'React.PropTypes.func',
75+
'any' => 'React.PropTypes.any',
76+
77+
'instanceOf' => ->(type) {
7878
'React.PropTypes.instanceOf(%s)' % type.to_s.camelize
7979
},
8080

81-
"oneOf" => ->(*options) {
81+
'oneOf' => ->(*options) {
8282
enums = options.map{|k| "'#{k.to_s}'"}.join(',')
8383
'React.PropTypes.oneOf([%s])' % enums
8484
},
8585

86-
"oneOfType" => ->(*options) {
86+
'oneOfType' => ->(*options) {
8787
types = options.map{|k| "#{lookup(k.to_s, k.to_s)}" }.join(',')
8888
'React.PropTypes.oneOfType([%s])' % types
8989
},
@@ -102,9 +102,9 @@ def create_component_file
102102
# Prefer webpacker to sprockets:
103103
if webpacker?
104104
new_file_name = file_name.camelize
105-
extension = options[:coffee] ? "coffee" : "js"
105+
extension = options[:coffee] ? 'coffee' : 'js'
106106
target_dir = webpack_configuration.source_path
107-
.join("components")
107+
.join('components')
108108
.relative_path_from(::Rails.root)
109109
.to_s
110110
else
@@ -131,15 +131,15 @@ def file_header
131131
if webpacker?
132132
%|var React = require("react")\n|
133133
else
134-
""
134+
''
135135
end
136136
end
137137

138138
def file_footer
139139
if webpacker?
140140
%|module.exports = #{component_name}|
141141
else
142-
""
142+
''
143143
end
144144
end
145145

@@ -149,7 +149,7 @@ def webpacker?
149149

150150
def parse_attributes!
151151
self.attributes = (attributes || []).map do |attr|
152-
name, type, options = "", "", ""
152+
name, type, options = '', '', ''
153153
options_regex = /(?<options>{.*})/
154154

155155
name, type = attr.split(':')
@@ -163,7 +163,7 @@ def parse_attributes!
163163
end
164164
end
165165

166-
def self.lookup(type = "node", options = "")
166+
def self.lookup(type = 'node', options = '')
167167
react_prop_type = REACT_PROP_TYPES[type]
168168
if react_prop_type.blank?
169169
if type =~ /^[[:upper:]]/
@@ -179,7 +179,7 @@ def self.lookup(type = "node", options = "")
179179
react_prop_type
180180
end
181181

182-
def lookup(type = "node", options = "")
182+
def lookup(type = 'node', options = '')
183183
self.class.lookup(type, options)
184184
end
185185
end

lib/generators/react/install_generator.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ def create_server_rendering
4242
if options[:skip_server_rendering]
4343
return
4444
elsif webpacker?
45-
ssr_manifest_path = File.join(javascript_dir, "server_rendering.js")
46-
template("server_rendering_pack.js", ssr_manifest_path)
45+
ssr_manifest_path = File.join(javascript_dir, 'server_rendering.js')
46+
template('server_rendering_pack.js', ssr_manifest_path)
4747
else
48-
ssr_manifest_path = File.join(javascript_dir, "server_rendering.js")
49-
template("server_rendering.js", ssr_manifest_path)
50-
initializer_path = "config/initializers/react_server_rendering.rb"
51-
template("react_server_rendering.rb", initializer_path)
48+
ssr_manifest_path = File.join(javascript_dir, 'server_rendering.js')
49+
template('server_rendering.js', ssr_manifest_path)
50+
initializer_path = 'config/initializers/react_server_rendering.rb'
51+
template('react_server_rendering.rb', initializer_path)
5252
end
5353
end
5454

@@ -90,7 +90,7 @@ def setup_react_sprockets
9090
end
9191

9292
components_js = "//= require_tree ./components\n"
93-
components_file = File.join(javascript_dir, "components.js")
93+
components_file = File.join(javascript_dir, 'components.js')
9494
create_file components_file, components_js
9595
end
9696

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# To render React components in production, precompile the server rendering manifest:
2-
Rails.application.config.assets.precompile += ["server_rendering.js"]
2+
Rails.application.config.assets.precompile += ['server_rendering.js']

lib/react/jsx/babel_transformer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class BabelTransformer
77
DEFAULT_TRANSFORM_OPTIONS = { blacklist: ['spec.functionName', 'validation.react', 'strict'] }
88
def initialize(options)
99
if (options.keys & DEPRECATED_OPTIONS).any?
10-
ActiveSupport::Deprecation.warn("Setting config.react.jsx_transform_options for :harmony, :strip_types, and :asset_path keys is now deprecated and has no effect with the default Babel Transformer."+
11-
"Please use new Babel Transformer options :whitelist, :plugin instead.")
10+
ActiveSupport::Deprecation.warn('Setting config.react.jsx_transform_options for :harmony, :strip_types, and :asset_path keys is now deprecated and has no effect with the default Babel Transformer.'+
11+
'Please use new Babel Transformer options :whitelist, :plugin instead.')
1212
end
1313

1414
@transform_options = DEFAULT_TRANSFORM_OPTIONS.merge(options)

lib/react/jsx/jsx_transformer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def initialize(options)
2121

2222
def transform(code)
2323
result = @context.call('JSXTransformer.transform', code, @transform_options)
24-
result["code"]
24+
result['code']
2525
end
2626

2727
# search for transformer file using sprockets - allows user to override

0 commit comments

Comments
 (0)