File size: 1,698 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
const globals = require('globals')
const { name, version } = require('../package.json')
const plugin = {
meta: { name, version },
configs: {},
rules: {
'no-assigning-return-values': require('./rules/no-assigning-return-values'),
'unsafe-to-chain-command': require('./rules/unsafe-to-chain-command'),
'no-unnecessary-waiting': require('./rules/no-unnecessary-waiting'),
'no-async-before': require('./rules/no-async-before'),
'no-async-tests': require('./rules/no-async-tests'),
'assertion-before-screenshot': require('./rules/assertion-before-screenshot'),
'require-data-selectors': require('./rules/require-data-selectors'),
'no-force': require('./rules/no-force'),
'no-pause': require('./rules/no-pause'),
},
}
const commonGlobals =
Object.assign({
cy: false,
Cypress: false,
expect: false,
assert: false,
chai: false,
}, globals.browser, globals.mocha)
const commonLanguageOptions = {
ecmaVersion: 2019,
sourceType: 'module'
}
Object.assign(plugin.configs, {
globals: {
name: 'cypress/globals',
plugins: {
cypress: plugin
},
languageOptions: {
globals:
commonGlobals,
...commonLanguageOptions
}
}
})
Object.assign(plugin.configs, {
recommended: {
name: 'cypress/recommended',
plugins: {
cypress: plugin
},
rules: {
'cypress/no-assigning-return-values': 'error',
'cypress/no-unnecessary-waiting': 'error',
'cypress/no-async-tests': 'error',
'cypress/unsafe-to-chain-command': 'error',
},
languageOptions: {
globals:
commonGlobals,
...commonLanguageOptions
}
}
})
module.exports = plugin
|