Skip to content

Commit

Permalink
Remove standard in favour of eslint
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 3572842 commit 2ca846b
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 645 deletions.
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)'
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'
28 changes: 6 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 2ca846b

Please sign in to comment.