Skip to content

Commit

Permalink
feat: update dependencies + add new globals (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored Jan 18, 2024
1 parent 5547139 commit 867f770
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 156 deletions.
191 changes: 77 additions & 114 deletions lib/configs/_base.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/**
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*/
"use strict"

const { Linter } = require("eslint")
const semver = require("semver")

const isESLint7OrHigher = semver.gte(Linter.version, "7.0.0")
const isESLint8OrHigher = semver.gte(Linter.version, "8.0.0")
const isESLint850OrHigher = semver.gte(Linter.version, "8.50.0")
const isESLint853OrHigher = semver.gte(Linter.version, "8.53.0")

/** @type {import('eslint').Linter.Config} */
module.exports = {
Expand Down Expand Up @@ -43,10 +41,7 @@ module.exports = {
"getter-return": "error",
"grouped-accessor-pairs": "error",
"init-declarations": "error",
"linebreak-style": ["error", "unix"],
"lines-between-class-members": "error",
...(isESLint8OrHigher ? { "logical-assignment-operators": "off" } : {}), // TODO: enable once we drop ESLint v7 support
"max-statements-per-line": ["error", { max: 1 }],
"multiline-comment-style": ["error", "separate-lines"],
"new-cap": "error",
"no-alert": "error",
Expand Down Expand Up @@ -107,21 +102,14 @@ module.exports = {
"no-loop-func": "error",
...(isESLint7OrHigher ? { "no-loss-of-precision": "off" } : {}), // TODO: enable once we drop ESLint v6 support
"no-misleading-character-class": "error",
"no-mixed-operators": [
"error",
{
groups: [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["&&", "||"],
],
},
],
"no-new": "error",
...(isESLint8OrHigher ? { "no-new-native-nonconstructor": "off" } : {}), // TODO: enable once we drop ESLint v7 support
"no-new-object": "error",
"no-new-require": "error",
"no-new-wrappers": "error",
...(isESLint7OrHigher ? { "no-nonoctal-decimal-escape": "off" } : {}), // TODO: enable once we drop ESLint v6 support
...(isESLint850OrHigher
? { "no-object-constructor": "error" }
: { "no-new-object": "error" }), // TODO: remove once we drop ESLint v8.50 support
"no-obj-calls": "error",
"no-octal": "error",
"no-octal-escape": "error",
Expand Down Expand Up @@ -152,7 +140,6 @@ module.exports = {
"no-shadow": ["error", { builtinGlobals: true }],
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-tabs": "error",
"no-throw-literal": "error",
"no-undef": ["error", { typeof: true }],
"no-unexpected-multiline": "error",
Expand Down Expand Up @@ -194,48 +181,13 @@ module.exports = {
uninitialized: "always",
},
],
"padding-line-between-statements": [
"error",
{ blankLine: "always", next: "*", prev: "directive" },
{ blankLine: "always", next: "function", prev: "*" },
{ blankLine: "always", next: "*", prev: "function" },
],
"prefer-exponentiation-operator": "error",
...(isESLint8OrHigher ? { "prefer-object-has-own": "off" } : {}), // TODO: enable once we drop ESLint v7 support
"prefer-promise-reject-errors": "error",
"prefer-regex-literals": "error",
quotes: ["error", "double", { avoidEscape: true }],
radix: "error",
"require-atomic-updates": "error",
"require-await": "error",
"spaced-comment": [
"error",
"always",
{
block: {
balanced: true,
markers: [
"eslint",
"eslint-env",
"eslint-disable",
"eslint-enable",
"exported",
"globals",
"istanbul",
],
},
line: {
exceptions: ["-", "="],
markers: [
"eslint-disable-line",
"eslint-disable-next-line",
"istanbul",
"TODO:",
"FIXME:",
],
},
},
],
strict: ["error", "global"],
"use-isnan": [
"error",
Expand All @@ -250,64 +202,77 @@ module.exports = {
"max-params": ["warn", { max: 8 }],
"no-console": ["warn", { allow: ["assert", "error"] }],

// Disabled rules as favor of Prettier.
"array-bracket-newline": "off",
"array-bracket-spacing": "off",
"array-element-newline": "off",
"arrow-parens": "off",
"arrow-spacing": "off",
"block-spacing": "off",
"brace-style": "off",
"comma-dangle": "off",
"comma-spacing": "off",
"comma-style": "off",
"computed-property-spacing": "off",
"dot-location": "off",
"eol-last": "off",
"func-call-spacing": "off",
"function-call-argument-newline": "off",
"function-paren-newline": "off",
"generator-star-spacing": "off",
"implicit-arrow-linebreak": "off",
indent: "off",
"jsx-quotes": "off",
"key-spacing": "off",
"keyword-spacing": "off",
"multiline-ternary": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"no-extra-parens": "off",
"no-extra-semi": "off",
"no-floating-decimal": "off",
"no-mixed-spaces-and-tabs": "off",
"no-multi-spaces": "off",
"no-multiple-empty-lines": "off",
"no-trailing-spaces": "off",
"no-whitespace-before-property": "off",
"nonblock-statement-body-position": "off",
"object-curly-newline": "off",
"object-curly-spacing": "off",
"object-property-newline": "off",
"one-var-declaration-per-line": "off",
"operator-linebreak": "off",
"padded-blocks": "off",
"quote-props": "off",
"rest-spread-spacing": "off",
semi: "off",
"semi-spacing": "off",
"semi-style": "off",
"space-before-blocks": "off",
"space-before-function-paren": "off",
"space-in-parens": "off",
"space-infix-ops": "off",
"space-unary-ops": "off",
"switch-colon-spacing": "off",
"template-curly-spacing": "off",
"template-tag-spacing": "off",
"unicode-bom": "off",
"wrap-iife": "off",
"wrap-regex": "off",
"yield-star-spacing": "off",
...(isESLint853OrHigher
? {}
: {
"array-bracket-newline": "off",
"array-bracket-spacing": "off",
"array-element-newline": "off",
"arrow-parens": "off",
"arrow-spacing": "off",
"block-spacing": "off",
"brace-style": "off",
"comma-dangle": "off",
"comma-spacing": "off",
"comma-style": "off",
"computed-property-spacing": "off",
"dot-location": "off",
"eol-last": "off",
"func-call-spacing": "off",
"function-call-argument-newline": "off",
"function-paren-newline": "off",
"generator-star-spacing": "off",
"implicit-arrow-linebreak": "off",
indent: "off",
"jsx-quotes": "off",
"key-spacing": "off",
"keyword-spacing": "off",
"linebreak-style": "off",
"lines-around-comment": "off",
"lines-between-class-members": "off",
"max-len": "off",
"max-statements-per-line": "off",
"multiline-ternary": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"no-confusing-arrow": "off",
"no-extra-parens": "off",
"no-extra-semi": "off",
"no-floating-decimal": "off",
"no-mixed-operators": "off",
"no-mixed-spaces-and-tabs": "off",
"no-multi-spaces": "off",
"no-multiple-empty-lines": "off",
"no-tabs": "off",
"no-trailing-spaces": "off",
"no-whitespace-before-property": "off",
"nonblock-statement-body-position": "off",
"object-curly-newline": "off",
"object-curly-spacing": "off",
"object-property-newline": "off",
"one-var-declaration-per-line": "off",
"operator-linebreak": "off",
"padded-blocks": "off",
"padding-line-between-statements": "off",
"quote-props": "off",
quotes: "off",
"rest-spread-spacing": "off",
semi: "off",
"semi-spacing": "off",
"semi-style": "off",
"space-before-blocks": "off",
"space-before-function-paren": "off",
"space-in-parens": "off",
"space-infix-ops": "off",
"space-unary-ops": "off",
"spaced-comment": "off",
"switch-colon-spacing": "off",
"template-curly-spacing": "off",
"template-tag-spacing": "off",
"wrap-iife": "off",
"wrap-regex": "off",
"yield-star-spacing": "off",
}), // TODO: remove once we drop ESLint v8.53 support

// Disabled rules
"arrow-body-style": "off",
Expand All @@ -327,18 +292,15 @@ module.exports = {
"id-length": "off",
"id-match": "off",
"line-comment-position": "off",
"lines-around-comment": "off",
"max-classes-per-file": "off",
"max-depth": "off",
"max-len": "off",
"max-lines": "off",
"max-lines-per-function": "off",
"max-statements": "off",
"no-await-in-loop": "off",
"no-bitwise": "off",
"no-buffer-constructor": "off",
"no-class-assign": "off",
"no-confusing-arrow": "off",
"no-const-assign": "off",
"no-continue": "off",
"no-dupe-class-members": "off",
Expand Down Expand Up @@ -391,6 +353,7 @@ module.exports = {
"sort-keys": "off",
"sort-vars": "off",
"symbol-description": "off",
"unicode-bom": "off",
"vars-on-top": "off",

//
Expand Down
38 changes: 38 additions & 0 deletions lib/configs/_browser-globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ module.exports = {
CloseEvent: "readonly",
Comment: "readonly",
CompositionEvent: "readonly",
CompressionStream: "readonly",
ConstantSourceNode: "readonly",
ConvolverNode: "readonly",
CountQueuingStrategy: "readonly",
Expand Down Expand Up @@ -106,6 +107,7 @@ module.exports = {
DataTransfer: "readonly",
DataTransferItem: "readonly",
DataTransferItemList: "readonly",
DecompressionStream: "readonly",
DelayNode: "readonly",
DeviceMotionEvent: "readonly",
DeviceOrientationEvent: "readonly",
Expand Down Expand Up @@ -265,6 +267,7 @@ module.exports = {
MediaStream: "readonly",
MediaStreamAudioDestinationNode: "readonly",
MediaStreamAudioSourceNode: "readonly",
MediaStreamConstraints: "readonly",
MediaStreamEvent: "readonly",
MediaStreamTrack: "readonly",
MediaStreamTrackEvent: "readonly",
Expand Down Expand Up @@ -353,7 +356,12 @@ module.exports = {
RTCTrackEvent: "readonly",
RadioNodeList: "readonly",
Range: "readonly",
ReadableByteStreamController: "readonly",
ReadableStream: "readonly",
ReadableStreamBYOBReader: "readonly",
ReadableStreamBYOBRequest: "readonly",
ReadableStreamDefaultController: "readonly",
ReadableStreamDefaultReader: "readonly",
RemotePlayback: "readonly",
Request: "readonly",
ResizeObserver: "readonly",
Expand Down Expand Up @@ -483,19 +491,23 @@ module.exports = {
TaskAttributionTiming: "readonly",
Text: "readonly",
TextDecoder: "readonly",
TextDecoderStream: "readonly",
TextEncoder: "readonly",
TextEncoderStream: "readonly",
TextEvent: "readonly",
TextMetrics: "readonly",
TextTrack: "readonly",
TextTrackCue: "readonly",
TextTrackCueList: "readonly",
TextTrackList: "readonly",
TimeRanges: "readonly",
ToggleEvent: "readonly",
Touch: "readonly",
TouchEvent: "readonly",
TouchList: "readonly",
TrackEvent: "readonly",
TransformStream: "readonly",
TransformStreamDefaultController: "readonly",
TransitionEvent: "readonly",
TreeWalker: "readonly",
UIEvent: "readonly",
Expand Down Expand Up @@ -528,6 +540,8 @@ module.exports = {
Window: "readonly",
Worker: "readonly",
WritableStream: "readonly",
WritableStreamDefaultController: "readonly",
WritableStreamDefaultWriter: "readonly",
XMLDocument: "readonly",
XMLHttpRequest: "readonly",
XMLHttpRequestEventTarget: "readonly",
Expand All @@ -536,6 +550,30 @@ module.exports = {
XPathEvaluator: "readonly",
XPathExpression: "readonly",
XPathResult: "readonly",
XRAnchor: "readonly",
XRBoundedReferenceSpace: "readonly",
XRCPUDepthInformation: "readonly",
XRDepthInformation: "readonly",
XRFrame: "readonly",
XRInputSource: "readonly",
XRInputSourceArray: "readonly",
XRInputSourceEvent: "readonly",
XRInputSourcesChangeEvent: "readonly",
XRPose: "readonly",
XRReferenceSpace: "readonly",
XRReferenceSpaceEvent: "readonly",
XRRenderState: "readonly",
XRRigidTransform: "readonly",
XRSession: "readonly",
XRSessionEvent: "readonly",
XRSpace: "readonly",
XRSystem: "readonly",
XRView: "readonly",
XRViewerPose: "readonly",
XRViewport: "readonly",
XRWebGLBinding: "readonly",
XRWebGLDepthInformation: "readonly",
XRWebGLLayer: "readonly",
XSLTProcessor: "readonly",
atob: "readonly",
btoa: "readonly",
Expand Down
8 changes: 2 additions & 6 deletions lib/configs/_override-2015.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/**
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*/
"use strict"

/** @type {import('eslint').Linter.Config} */
module.exports = {
parserOptions: {
ecmaVersion: 2015,
Expand Down Expand Up @@ -68,12 +65,11 @@ module.exports = {
"arrow-parens": "off",
"arrow-spacing": "off",
"generator-star-spacing": "off",
"no-confusing-arrow": "off",
"rest-spread-spacing": "off",
"template-curly-spacing": "off",
"yield-star-spacing": "off",

// Desabled rules
// Disabled rules
"no-inner-declarations": "off",
"no-restricted-imports": "off",
"prefer-destructuring": "off",
Expand Down
Loading

0 comments on commit 867f770

Please sign in to comment.