Skip to content

Commit

Permalink
set up minimal eslint system
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Jun 8, 2020
1 parent 7322700 commit 1f8d08c
Show file tree
Hide file tree
Showing 5 changed files with 328 additions and 31 deletions.
39 changes: 39 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module' // Allows for the use of imports
},
plugins: [
'@typescript-eslint',
'react'
],
settings: {
react: {
version: 'detect'
}
},
extends: [
'eslint:recommended',
'plugin:react/recommended'
],
rules: {
'no-unused-vars': 0, // because can't get jsxFactory to work. and don't like func arg stipulation
'no-undef': 0, // because tsc does this. hard to make work with tests globals
'prefer-const': 0,
'prefer-spread': 0,
'prefer-rest-params': 0,
'react/react-in-jsx-scope': 0, // requires React to always be imported
'react/display-name': 0,
'react/prop-types': 0,

'@typescript-eslint/ban-types': 'error'

// TODO: enable lots of typescript rules found here:
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/docs/rules
// The reason we didn't enable 'plugin:@typescript-eslint/recommended' was because it required
// REALLY slow ts processing. Somehow enable all rules that DON'T cause things to be slow.
}
}
10 changes: 0 additions & 10 deletions eslint.json

This file was deleted.

37 changes: 37 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const exec = require('./scripts/lib/shell').sync.withOptions({ // always SYNC!
const concurrently = require('concurrently')
const { minifyBundleJs, minifyBundleCss } = require('./scripts/lib/minify')
const modify = require('gulp-modify-file')
const { allStructs } = require('./scripts/lib/package-index')



Expand Down Expand Up @@ -329,3 +330,39 @@ function execParallel(map) {
func.displayName = 'concurrently'
return func
}



const exec3 = require('./scripts/lib/shell').sync.withOptions({
live: true,
exitOnError: false
})

exports.eslint = function() {
let anyFailures = false

for (let struct of allStructs) {
if (struct.name !== '@fullcalendar/core-vdom') {
let cmd = [
'eslint', '--config', 'eslint.config.js',
path.join(struct.dir, 'src'),
'--ext', '.ts,.tsx,.js,.jsx'
]

console.log('Running eslint on', struct.name, '...')
console.log(cmd.join(' '))
console.log()

let { success } = exec3(cmd)
if (!success) {
anyFailures = true
}
}
}

if (anyFailures) {
return Promise.reject(new Error('At least one linting job failed'))
}

return Promise.resolve()
}
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,16 @@
"@types/jquery": "^3.3.29",
"@types/luxon": "^1.12.0",
"@types/node": "^12.12.14",
"@typescript-eslint/eslint-plugin": "^3.1.0",
"@typescript-eslint/parser": "^3.1.0",
"bootstrap": "^3.4.1",
"chokidar": "^2.1.5",
"components-jqueryui": "github:components/jqueryui",
"concurrently": "^4.1.1",
"css-loader": "^3.5.3",
"dragula": "^3.7.2",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0",
"eslint": "^7.2.0",
"eslint-plugin-react": "^7.20.0",
"glob": "^7.1.3",
"globby": "^11.0.0",
"gulp": "^4.0.2",
Expand Down

0 comments on commit 1f8d08c

Please sign in to comment.