- Client vs server rendering
- Hmr and hot reloading with the webpack dev server
- How to use different files for client and server rendering
- React server rendering
- Render functions and railscontext
- Rspec configuration
- Webpack configuration
- Upgrading react on rails
- React on rails overview
- Minitest configuration
- How to conditionally server render based on device type
- How react on rails works
- Installation into an existing rails app
- Rails webpacker react integration options
- File system based automated bundle generation
- Convert rails 5 api only app
- Rails engine integration
- Asset pipeline
- Capistrano deployment
- Converting from custom webpack config to rails webpacker config
- Code splitting
- Angular js integration migration
- Foreman issues
- React and redux
- React router
- React helmet
- Server rendering tips
- Troubleshooting when using webpacker
- Webpack v1 notes
- Node dependencies and npm
- Generator details
- Migrating from react rails
- Updating dependencies
- Upgrade webpacker v3 to v4
- Manual installation overview
- Recommended project structure
- Errors with hooks
- Pull requests
- Generator testing
Copyright 2020 ShakaCode
These linters support the ShakaCode Style Guidelines
If you haven't tried the autofix options for
rubocop, you're seriously missing out!
Be SURE you have a clean git status, as you'll want to review what the autofix does to your code!
Rubocop: Be sure to be in the right directory where you have Ruby files, probably the top level of your Rails project.
eslint:: Be sure to be in the right directory where you have JS files.
eslint --fix .
npm run lint -- --fix
Autofixing is a HUGE time saver!
Rules are configured with a 0, 1 or 2. Setting a rule to 0 is turning it off, setting it to 1 triggers a warning if that rule is violated, and setting it to 2 triggers an error.
Rules can also take a few additional options. In this case, the rule can be set to an array, the first item of which is the 0/1/2 flag and the rest are options.
See file .eslintrc for examples of configuration
Specify/Override rules in code
For example, if your file assumes a few globals and you have the no-undef rule set in the .eslintrc file, you might want to relax the rule in the current file.
/* global $, window, angular */ // rest of code
It's also useful to disable ESLint for particular lines or blocks of lines.
console.log('console.log not allowed'); // eslint-disable-line alert('alert not allowed'); // eslint-disable-line no-alert /* eslint-disable no-console, no-alert */ console.log('more console.log'); alert('more alert'); /* eslint-enable no-console, no-alert */
You can disable all rules for a line or block, or only specific rules, as shown above.