Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove standard in favour of eslint #1605

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove standard in favour of eslint
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
tagliala committed Dec 25, 2023
commit 2ca846b66404d99817350b881670781805cb861b
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**/vendor/*.js
/app/assets/config/manifest.js
/config/**/*.js
23 changes: 23 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
root: true,
extends: [
'standard'
],
globals: {
'$': true,
'ClientSideValidations': true,
'google': true,
'Handlebars': true,
'HandlebarsTemplates': true,
'I18n': true,
'InfoBox': true,
'initGoogleMaps': true
},
settings: {
'import/resolver': {
node: {
paths: ['app/javascript']
}
}
}
}
26 changes: 6 additions & 20 deletions config/webpack/development.js
Original file line number Diff line number Diff line change
@@ -1,28 +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: [
'$',
'ClientSideValidations',
'google',
'Handlebars',
'HandlebarsTemplates',
'InfoBox',
'initGoogleMaps'
]
}
}
]
},
plugins: [
new ESLintPlugin({
failOnError: false,
files: 'app/javascript/**/*.js',
exclude: 'app/javascript/**/vendor/*.js'
}),
new StyleLintPlugin({
failOnError: false,
files: 'app/javascript/**/*.(s(c|a)ss|css)'
8 changes: 4 additions & 4 deletions lib/tasks/yarn_linters.rake
Original file line number Diff line number Diff line change
@@ -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'
28 changes: 6 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -54,35 +54,19 @@
"@babel/eslint-parser": "^7.23.3",
"@types/express": "^4.17.21",
"@webpack-cli/serve": "^2.0.5",
"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"
],
"globals": [
"$",
"ClientSideValidations",
"google",
"Handlebars",
"HandlebarsTemplates",
"I18n",
"InfoBox",
"initGoogleMaps"
]
},
"babel": {
"presets": [
"./node_modules/shakapacker/package/babel/preset.js"
753 changes: 154 additions & 599 deletions yarn.lock

Large diffs are not rendered by default.