Skip to content

Commit

Permalink
Replace standard with eslint-config-standard
Browse files Browse the repository at this point in the history
Mostly because of unmaintained libraries in the Standard family and
the upcoming migration to Vite

Ref:
- standard/standardx#42
- standard/eslint-config-standard#229
- standard/standard-loader#104
  • Loading branch information
tagliala committed Dec 25, 2023
1 parent c89b01d commit d7c4a3d
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 646 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/app/assets/config/manifest.js
/app/assets/javascript/**/vendor/*.js
/config/**/*.js
13 changes: 13 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
root: true,
extends: [
'standard'
],
settings: {
'import/resolver': {
node: {
paths: ['app/javascript']
}
}
}
}
20 changes: 6 additions & 14 deletions config/webpack/development.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
const ESLintPlugin = require('eslint-webpack-plugin')
const StyleLintPlugin = require('stylelint-webpack-plugin')

module.exports = {
envSpecificConfig: {
module: {
rules: [
{
test: /\.js$/,
exclude: /vendor\/.+\.js$/,
loader: 'standard-loader',
options: {
globals: [
'$'
]
}
}
]
},
plugins: [
new ESLintPlugin({
failOnError: false,
files: 'app/javascript/**/*.js',
exclude: 'app/assets/javascript/**/vendor/*.js'
}),
new StyleLintPlugin({
failOnError: false,
files: 'app/javascript/**/*.(s(c|a)ss|css)'
Expand Down
8 changes: 4 additions & 4 deletions lib/tasks/yarn_linters.rake
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ namespace :yarn do
Rake::Task['yarn:run'].execute(command: "stylelint #{Dir.glob('app/**/*.scss').join(' ')}")
end

desc 'Run `bin/yarn standard`'
task :standard do
Rake::Task['yarn:run'].execute(command: 'standard')
desc 'Run `bin/yarn eslint`'
task :eslint do
Rake::Task['yarn:run'].execute(command: 'eslint app/**/*.js')
end
# rubocop:enable Rails/RakeEnvironment
end

task(:lint).sources.push 'yarn:stylelint'
task(:lint).sources.push 'yarn:standard'
task(:lint).sources.push 'yarn:eslint'
18 changes: 6 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,19 @@
"@babel/eslint-parser": "^7.23.3",
"@types/express": "^4.17.21",
"@webpack-cli/serve": "^2.0.4",
"eslint": "^8.56.0",
"standard": "^16.0.3",
"standard-loader": "^7.0.0",
"eslint": ">=8.27.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.5.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-webpack-plugin": "^4.0.1",
"stylelint": "^15.11.0",
"stylelint-config-twbs-bootstrap": "^12.0.0",
"stylelint-order": "^6.0.4",
"stylelint-scss": "^5.3.2",
"stylelint-webpack-plugin": "^4.1.1",
"webpack-dev-server": "^4.15.1"
},
"standard": {
"parser": "@babel/eslint-parser",
"ignore": [
"/*.js",
"app/assets/javascripts",
"app/javascript/src/vendor",
"/config"
]
},
"babel": {
"presets": [
"./node_modules/shakapacker/package/babel/preset.js"
Expand Down
Loading

0 comments on commit d7c4a3d

Please sign in to comment.