Skip to content

Commit

Permalink
242 eslint check doesnt catch indentation errors (#257)
Browse files Browse the repository at this point in the history
* Add indentation rule
* Fix linter issues
  • Loading branch information
ahangarha authored Mar 7, 2023
1 parent ec3bb6e commit e926140
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': 'off',
'import/extensions': 'off',
"indent": ["error", 2],
semi: ['error', 'never']
},
env: {
Expand Down
22 changes: 11 additions & 11 deletions package/rules/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ const { isProduction } = require('../env')
const jscommon = require('./jscommon')

module.exports = loaderMatches(webpackLoader, 'babel', () => ({
test: /\.(js|jsx|mjs|ts|tsx|coffee)?(\.erb)?$/,
...jscommon,
use: [
{
loader: require.resolve('babel-loader'),
options: {
cacheDirectory: true,
cacheCompression: isProduction,
compact: isProduction
}
test: /\.(js|jsx|mjs|ts|tsx|coffee)?(\.erb)?$/,
...jscommon,
use: [
{
loader: require.resolve('babel-loader'),
options: {
cacheDirectory: true,
cacheCompression: isProduction,
compact: isProduction
}
]
}
]
}))
32 changes: 16 additions & 16 deletions package/rules/jscommon.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
const { resolve } = require('path')
const { realpathSync } = require('fs')
const {
source_path: sourcePath,
additional_paths: additionalPaths
source_path: sourcePath,
additional_paths: additionalPaths
} = require('../config')

const inclusions = [sourcePath, ...additionalPaths].map(p => {
try {
return realpathSync(p)
} catch (e) {
return resolve(p)
}
try {
return realpathSync(p)
} catch (e) {
return resolve(p)
}
})

module.exports = {
include: inclusions,
exclude: [
{
// exclude all node_modules from running through babel-loader
and: [resolve('node_modules')],
// Do not exclude inclusions, as otherwise these won't be transpiled
not: [...inclusions]
}
]
include: inclusions,
exclude: [
{
// exclude all node_modules from running through babel-loader
and: [resolve('node_modules')],
// Do not exclude inclusions, as otherwise these won't be transpiled
not: [...inclusions]
}
]
}

0 comments on commit e926140

Please sign in to comment.