rails / webpacker

Use Webpack to manage app-like JavaScript modules in Rails
MIT License
5.31k stars 1.47k forks source link

Use `exist?` instead of deprecated `exists?` #3250

Closed koic closed 2 years ago

koic commented 2 years ago

Dir.exists? and `File.exists? were removed by https://github.com/ruby/ruby/pull/5352. It will be the following error in Ruby 3.2.

% ruby -ve 'File.exists?("foo.rb")'
ruby 3.2.0dev (2021-12-28T15:22:18Z master 39b3aa4fb3) [x86_64-darwin19]
-e:1:in `<main>': undefined method `exists?' for File:Class (NoMethodError)

File.exists?("foo.rb")
    ^^^^^^^^
Did you mean?  exist?

And this PR enables Lint/DeprecatedClassMethods cop to detect these deprecated methods.

koic commented 2 years ago

The build error is unrelated to this change. #3251 will solve it.