Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Nov 1, 2024
1 parent 1452679 commit f387b90
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const recurseArray = ({
})

if (state.value !== undefined) {
// eslint-disable-next-line fp/no-mutating-methods
newArray.push(state.value)
}
}
Expand Down
1 change: 1 addition & 0 deletions src/cycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const checkCycleThenRecurse = ({
}

if (ancestors.has(value)) {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: value,
Expand Down
4 changes: 4 additions & 0 deletions src/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const safeGetProp = ({ parent, key, changes, path }) => {
const prop = getProp({ parent, key, changes, path })
return { prop, safe: true }
} catch (error) {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: undefined,
Expand All @@ -40,6 +41,7 @@ const getProp = ({ parent, key, changes, path }) => {
// When `parent[key]` was a getter and|or setter
const addGetterChange = ({ changes, path, prop, descriptor: { get, set } }) => {
if (get !== undefined || set !== undefined) {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: get,
Expand All @@ -57,6 +59,7 @@ const addDescriptorChange = ({
descriptor: { writable, configurable },
}) => {
if (writable === false) {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: prop,
Expand All @@ -66,6 +69,7 @@ const addDescriptorChange = ({
}

if (configurable === false) {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: prop,
Expand Down
4 changes: 3 additions & 1 deletion src/get.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ each(
],
({ title }, { descriptor, reason }) => {
test(`Make properties configurable and writable | ${title}`, (t) => {
// eslint-disable-next-line fp/no-mutating-methods
const input = Object.defineProperty({}, 'prop', {
value: true,
enumerable: true,
Expand Down Expand Up @@ -60,7 +61,7 @@ each(
input: {
// eslint-disable-next-line fp/no-get-set
get prop() {
// eslint-disable-next-line fp/no-this
// eslint-disable-next-line fp/no-mutating-methods, fp/no-this
Object.defineProperty(this, 'prop', {
value: true,
enumerable: true,
Expand Down Expand Up @@ -106,6 +107,7 @@ test('Resolve setters without getters', (t) => {

test('Omit getters that throw', (t) => {
const error = new Error('test')
// eslint-disable-next-line fp/no-mutating-methods
const input = Object.defineProperty({}, 'prop', {
get: () => {
throw error.message
Expand Down
1 change: 1 addition & 0 deletions src/indices.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const addNotArrayIndexChanges = (array, changes, path) => {

for (const key of Reflect.ownKeys(array)) {
if (!arrayProps.has(key)) {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path: [...path, key],
oldValue: safeGetChangeProp({ parent: array, key }),
Expand Down
1 change: 1 addition & 0 deletions src/indices.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ each(
// eslint-disable-next-line max-params
({ title }, key, enumerable, { descriptor, oldValue }) => {
test(`Omit array properties that are not indices | ${title}`, (t) => {
// eslint-disable-next-line fp/no-mutating-methods
const array = Object.defineProperty([true], key, {
...descriptor,
enumerable,
Expand Down
2 changes: 2 additions & 0 deletions src/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// - Non-enumerable properties, except in arrays
export const omitInvalidKey = ({ parent, key, prop, changes, path }) => {
if (typeof key === 'symbol') {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: prop,
Expand All @@ -13,6 +14,7 @@ export const omitInvalidKey = ({ parent, key, prop, changes, path }) => {
}

if (!isEnum.call(parent, key) && !Array.isArray(parent)) {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: prop,
Expand Down
2 changes: 2 additions & 0 deletions src/key.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ each(
],
},
{
// eslint-disable-next-line fp/no-mutating-methods
input: Object.defineProperty({}, 'prop', {
value: true,
enumerable: false,
Expand All @@ -36,6 +37,7 @@ each(
],
},
{
// eslint-disable-next-line fp/no-mutating-methods
input: Object.defineProperty([], '0', {
value: true,
enumerable: false,
Expand Down
1 change: 1 addition & 0 deletions src/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test('Is deep by default on arrays', (t) => {

test('Can be shallow on objects', (t) => {
const value = { one: 0n }
// eslint-disable-next-line fp/no-mutating-methods
Object.defineProperty(value, 'two', {
value: true,
enumerable: false,
Expand Down
1 change: 1 addition & 0 deletions src/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const getNewObject = (object) =>
// - This mimics `JSON.stringify()` behavior
const addClassChange = ({ object, newObject, changes, path }) => {
if (!isPlainObj(object)) {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: object,
Expand Down
1 change: 1 addition & 0 deletions src/size.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const addSize = ({ type, size, maxSize, changes, path, context }) => {
return { size: newSize, stop }
}

// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: getOldValue(context),
Expand Down
1 change: 1 addition & 0 deletions src/size.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ each(
change: { reason: 'ignoredUndefined' },
},
{
// eslint-disable-next-line fp/no-mutating-methods
input: Object.defineProperty({}, 'prop', {
get: () => {
throw error
Expand Down
2 changes: 2 additions & 0 deletions src/to_json.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const callToJSON = (value, changes, path) => {

try {
const toJSONResult = triggerToJSON(value)
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: value,
Expand All @@ -26,6 +27,7 @@ export const callToJSON = (value, changes, path) => {
})
return toJSONResult
} catch (error) {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: value,
Expand Down
1 change: 1 addition & 0 deletions src/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const omitInvalidTypes = (value, changes, path) => {
return value
}

// eslint-disable-next-line fp/no-mutating-methods
changes.push({ path, oldValue: value, newValue: undefined, reason })
}

Expand Down
1 change: 1 addition & 0 deletions src/uncaught.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const handleUnsafeException = ({
error,
size,
}) => {
// eslint-disable-next-line fp/no-mutating-methods
changes.push({
path,
oldValue: value,
Expand Down

0 comments on commit f387b90

Please sign in to comment.