Skip to content

Commit 2de506a

Browse files
committed
Replace standard with eslint-config-standard
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
1 parent c89b01d commit 2de506a

File tree

6 files changed

+184
-646
lines changed

6 files changed

+184
-646
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/app/assets/config/manifest.js
2+
/app/assets/javascript/**/vendor/*.js
3+
/config/**/*.js

.eslintrc.cjs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
root: true,
3+
extends: [
4+
'standard'
5+
],
6+
settings: {
7+
'import/resolver': {
8+
node: {
9+
paths: ['app/javascript']
10+
}
11+
}
12+
}
13+
}

config/webpack/development.js

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1+
const ESLintPlugin = require('eslint-webpack-plugin')
12
const StyleLintPlugin = require('stylelint-webpack-plugin')
23

34
module.exports = {
45
envSpecificConfig: {
5-
module: {
6-
rules: [
7-
{
8-
test: /\.js$/,
9-
exclude: /vendor\/.+\.js$/,
10-
loader: 'standard-loader',
11-
options: {
12-
globals: [
13-
'$'
14-
]
15-
}
16-
}
17-
]
18-
},
196
plugins: [
7+
new ESLintPlugin({
8+
failOnError: false,
9+
files: 'app/javascript/**/*.js',
10+
exclude: 'app/javascript/**/vendor/*.js'
11+
}),
2012
new StyleLintPlugin({
2113
failOnError: false,
2214
files: 'app/javascript/**/*.(s(c|a)ss|css)'

lib/tasks/yarn_linters.rake

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ namespace :yarn do
2424
Rake::Task['yarn:run'].execute(command: "stylelint #{Dir.glob('app/**/*.scss').join(' ')}")
2525
end
2626

27-
desc 'Run `bin/yarn standard`'
28-
task :standard do
29-
Rake::Task['yarn:run'].execute(command: 'standard')
27+
desc 'Run `bin/yarn eslint`'
28+
task :eslint do
29+
Rake::Task['yarn:run'].execute(command: 'eslint app/**/*.js')
3030
end
3131
# rubocop:enable Rails/RakeEnvironment
3232
end
3333

3434
task(:lint).sources.push 'yarn:stylelint'
35-
task(:lint).sources.push 'yarn:standard'
35+
task(:lint).sources.push 'yarn:eslint'

package.json

+6-12
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,19 @@
4747
"@babel/eslint-parser": "^7.23.3",
4848
"@types/express": "^4.17.21",
4949
"@webpack-cli/serve": "^2.0.4",
50-
"eslint": "^8.56.0",
51-
"standard": "^16.0.3",
52-
"standard-loader": "^7.0.0",
50+
"eslint": ">=8.27.0",
51+
"eslint-config-standard": "^17.1.0",
52+
"eslint-plugin-import": "^2.29.1",
53+
"eslint-plugin-n": "^16.5.0",
54+
"eslint-plugin-promise": "^6.1.1",
55+
"eslint-webpack-plugin": "^4.0.1",
5356
"stylelint": "^15.11.0",
5457
"stylelint-config-twbs-bootstrap": "^12.0.0",
5558
"stylelint-order": "^6.0.4",
5659
"stylelint-scss": "^5.3.2",
5760
"stylelint-webpack-plugin": "^4.1.1",
5861
"webpack-dev-server": "^4.15.1"
5962
},
60-
"standard": {
61-
"parser": "@babel/eslint-parser",
62-
"ignore": [
63-
"/*.js",
64-
"app/assets/javascripts",
65-
"app/javascript/src/vendor",
66-
"/config"
67-
]
68-
},
6963
"babel": {
7064
"presets": [
7165
"./node_modules/shakapacker/package/babel/preset.js"

0 commit comments

Comments
 (0)