Skip to content

Commit 4e73d26

Browse files
authored
Merge pull request #2 from Elemigrante/linters
fix: find and fix problems with ESLint and Stylelint via Lefthook
2 parents 542a8b9 + 819b0cb commit 4e73d26

File tree

5 files changed

+31
-18
lines changed

5 files changed

+31
-18
lines changed

rails-bootstrap/.eslintrc.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,15 @@ module.exports = {
1111
sourceType: 'module',
1212
},
1313
plugins: ['@typescript-eslint'],
14-
rules: {},
14+
rules: {
15+
"no-console": "off",
16+
"no-restricted-syntax": [
17+
"error",
18+
{
19+
"selector": "CallExpression[callee.object.name='console']"
20+
+ "[callee.property.name!=/^(log|warn|error|info|trace)$/]",
21+
"message": "Unexpected property on console object was called"
22+
}
23+
]
24+
},
1525
};

rails-bootstrap/app/frontend/packs/application.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import LocalTime from "local-time";
77
import "../channels";
88

99
import "bootstrap";
10-
import "@fortawesome/fontawesome-free/css/all";
10+
import "@fortawesome/fontawesome-free/css/all.css";
11+
12+
import "../controllers"
1113

1214
Rails.start();
1315
ActiveStorage.start();
1416
LocalTime.start();
1517

16-
import "../controllers"
17-
18-
// require.context('../images', true);
18+
// require.context('../images', true);

rails-bootstrap/app/frontend/stylesheets/custom.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
border-radius: 50%;
2727
-moz-background-clip: padding-box;
2828
-webkit-background-clip: padding-box;
29-
background-clip: padding-box;
3029
background: indianred;
30+
background-clip: padding-box;
3131
content: '';
3232
display: inline-block;
3333
height: 8px;
3434
width: 8px;
3535
margin-right: 6px;
36-
}
36+
}

rails-bootstrap/babel.config.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1+
// eslint-disable-next-line func-names
12
module.exports = function (api) {
2-
var validEnv = ['development', 'test', 'production'];
3-
var currentEnv = api.env();
4-
var isDevelopmentEnv = api.env('development');
5-
var isProductionEnv = api.env('production');
6-
var isTestEnv = api.env('test');
3+
const validEnv = ['development', 'test', 'production'];
4+
const currentEnv = api.env();
5+
const isDevelopmentEnv = api.env('development');
6+
const isProductionEnv = api.env('production');
7+
const isTestEnv = api.env('test');
78

89
if (!validEnv.includes(currentEnv)) {
910
throw new Error(
10-
'Please specify a valid `NODE_ENV` or ' +
11-
'`BABEL_ENV` environment variables. Valid values are "development", ' +
12-
'"test", and "production". Instead, received: ' +
13-
JSON.stringify(currentEnv) +
14-
'.'
11+
`${
12+
'Please specify a valid `NODE_ENV` or '
13+
+ '`BABEL_ENV` environment variables. Valid values are "development", '
14+
+ '"test", and "production". Instead, received: '
15+
}${JSON.stringify(currentEnv)}.`,
1516
);
1617
}
1718

rails-bootstrap/config/webpack/environment.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ options.implementation = require('sass')
1313
function hotfixPostcssLoaderConfig(subloader) {
1414
const subloaderName = subloader.loader
1515
if (subloaderName === 'postcss-loader') {
16+
// eslint-disable-next-line no-param-reassign
1617
subloader.options.postcssOptions = subloader.options.config
18+
// eslint-disable-next-line no-param-reassign
1719
delete subloader.options.config
1820
}
1921
}
@@ -23,4 +25,4 @@ environment.loaders.keys().forEach(loaderName => {
2325
loader.use.forEach(hotfixPostcssLoaderConfig)
2426
})
2527

26-
module.exports = environment
28+
module.exports = environment

0 commit comments

Comments
 (0)