Skip to content

Commit

Permalink
chore: upgrade to eslint9
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-siek committed May 14, 2024
1 parent b9969fa commit 8b4388c
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 28 deletions.
41 changes: 20 additions & 21 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// eslint-disable-next-line no-undef
const prettier = require('eslint-config-prettier');
const globals = require('globals');

// eslint-disable-next-line no-undef
module.exports = [
prettier,
{
Expand Down Expand Up @@ -93,8 +92,8 @@ module.exports = [
globals: {
axe: true,
Promise: true,
node: true,
es6: true
...globals.node,
...globals.es2015
}
}
},
Expand All @@ -104,10 +103,9 @@ module.exports = [
sourceType: 'module',
globals: {
window: true,
node: true,
es6: true,
// do not access global window properties without going through window
browser: false
document: true,
...globals.node,
...globals.es2015
}
},
rules: {
Expand All @@ -117,26 +115,26 @@ module.exports = [
}
},
{
// after functions and reporters will not be run inside the same context as axe.run so should not access browser globals that require context specific information (window.location, window.getComputedStyles, etc.)
files: ['lib/**/*-after.js', 'lib/core/reporters/**/*.js'],
files: ['doc/examples/chrome-debugging-protocol/axe-cdp.js'],
languageOptions: {
sourceType: 'module',
globals: {
browser: false
window: true
}
}
},
{
// after functions and reporters will not be run inside the same context as axe.run so should not access browser globals that require context specific information (window.location, window.getComputedStyles, etc.)
files: ['lib/**/*-after.js', 'lib/core/reporters/**/*.js'],
languageOptions: {
sourceType: 'module'
}
},
{
// polyfills are mostly copy-pasted from sources so we don't control their styling
files: [
'lib/core/imports/polyfills.js',
'lib/core/utils/pollyfill-elements-from-point.js'
],
languageOptions: {
globals: {
browser: false
}
},
rules: {
'func-names': 0,
'no-bitwise': 0,
Expand All @@ -148,7 +146,7 @@ module.exports = [
files: ['test/act-rules/**/*.js', 'test/aria-practices/**/*.js'],
languageOptions: {
globals: {
mocha: true
...globals.mocha
}
},
rules: {
Expand All @@ -160,9 +158,10 @@ module.exports = [
files: ['test/**/*.js'],
languageOptions: {
globals: {
mocha: true,
browser: true,
es6: false,
...globals.mocha,
...globals.browser,
...globals.es2015,
...globals.node,
assert: true,
helpers: true,
checks: true,
Expand Down
52 changes: 45 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"eslint-plugin-mocha-no-only": "^1.1.1",
"execa": "5.x",
"glob": "^10.3.10",
"globals": "^15.2.0",
"grunt": "^1.5.3",
"grunt-babel": "^8.0.0",
"grunt-bytesize": "^0.2.0",
Expand Down

0 comments on commit 8b4388c

Please sign in to comment.