mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #19757 from overleaf/ae-eslint-upgrade
Upgrade `@typescript-eslint` dependencies GitOrigin-RevId: b953e795d705b817ec3669b04cd6a289be12b20d
This commit is contained in:
parent
6ec26060e4
commit
901d79dd55
12 changed files with 789 additions and 920 deletions
1572
package-lock.json
generated
1572
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mocha": "^10.0.6",
|
"@types/mocha": "^10.0.6",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||||
|
"@typescript-eslint/parser": "^8.0.0",
|
||||||
"eslint": "^8.15.0",
|
"eslint": "^8.15.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-config-standard": "^17.0.0",
|
"eslint-config-standard": "^17.0.0",
|
||||||
|
|
|
@ -85,6 +85,8 @@ module.exports = {
|
||||||
// we don't enforce this at the top-level - just in tests to manage `this` scope
|
// we don't enforce this at the top-level - just in tests to manage `this` scope
|
||||||
// based on mocha's context mechanism
|
// based on mocha's context mechanism
|
||||||
'mocha/prefer-arrow-callback': 'error',
|
'mocha/prefer-arrow-callback': 'error',
|
||||||
|
|
||||||
|
'@typescript-eslint/no-unused-expressions': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -133,13 +135,20 @@ module.exports = {
|
||||||
message:
|
message:
|
||||||
"Don't map ObjectId directly. Use `id => new ObjectId(id)` instead",
|
"Don't map ObjectId directly. Use `id => new ObjectId(id)` instead",
|
||||||
},
|
},
|
||||||
|
// Catch incorrect usage of `await db.collection.find()`
|
||||||
|
{
|
||||||
|
selector:
|
||||||
|
"AwaitExpression > CallExpression > MemberExpression[property.name='find'][object.object.name='db']",
|
||||||
|
message:
|
||||||
|
'Mongo find returns a cursor not a promise, use `for await (const result of cursor)` or `.toArray()` instead.',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
'@typescript-eslint/no-floating-promises': 'error',
|
'@typescript-eslint/no-floating-promises': 'error',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Backend tests and scripts specific rules
|
// Backend scripts specific rules
|
||||||
files: ['**/test/**/*.*', '**/scripts/*.*'],
|
files: ['**/scripts/**/*.js'],
|
||||||
rules: {
|
rules: {
|
||||||
'no-restricted-syntax': [
|
'no-restricted-syntax': [
|
||||||
'error',
|
'error',
|
||||||
|
@ -274,38 +283,6 @@ module.exports = {
|
||||||
],
|
],
|
||||||
'no-restricted-syntax': [
|
'no-restricted-syntax': [
|
||||||
'error',
|
'error',
|
||||||
// Begin: Make sure angular can withstand minification
|
|
||||||
{
|
|
||||||
selector:
|
|
||||||
"CallExpression[callee.object.name='App'][callee.property.name=/run|directive|config|controller/] > :function[params.length > 0]",
|
|
||||||
message:
|
|
||||||
"Wrap the function in an array with the parameter names, to withstand minifcation. E.g. App.controller('MyController', ['param1', function(param1) {}]",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
selector:
|
|
||||||
"CallExpression[callee.object.name='App'][callee.property.name=/run|directive|config|controller/] > ArrayExpression > ArrowFunctionExpression",
|
|
||||||
message:
|
|
||||||
'Use standard function syntax instead of arrow function syntax in angular components. E.g. function(param1) {}',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
selector:
|
|
||||||
"CallExpression[callee.object.name='App'][callee.property.name=/run|directive|config|controller/] > ArrowFunctionExpression",
|
|
||||||
message:
|
|
||||||
'Use standard function syntax instead of arrow function syntax in angular components. E.g. function(param1) {}',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
selector:
|
|
||||||
"CallExpression[callee.object.name='App'][callee.property.name=/run|directive|config|controller/] > ArrayExpression > :not(:function, Identifier):last-child",
|
|
||||||
message:
|
|
||||||
"Last element of the array must be a function. E.g ['param1', function(param1) {}]",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
selector:
|
|
||||||
"CallExpression[callee.object.name='App'][callee.property.name=/run|directive|config|controller/] > ArrayExpression[elements.length=0]",
|
|
||||||
message:
|
|
||||||
"Array must not be empty. Add parameters and a function. E.g ['param1', function(param1) {}]",
|
|
||||||
},
|
|
||||||
// End: Make sure angular can withstand minification
|
|
||||||
// prohibit direct calls to methods of window.localStorage
|
// prohibit direct calls to methods of window.localStorage
|
||||||
{
|
{
|
||||||
selector:
|
selector:
|
||||||
|
@ -392,6 +369,13 @@ module.exports = {
|
||||||
'no-undef': 'off',
|
'no-undef': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// JavaScript-specific rules
|
||||||
|
{
|
||||||
|
files: ['**/*.js'],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-require-imports': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
files: ['scripts/ukamf/*.js'],
|
files: ['scripts/ukamf/*.js'],
|
||||||
rules: {
|
rules: {
|
||||||
|
|
|
@ -75,7 +75,11 @@ function MoreButton() {
|
||||||
|
|
||||||
function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {
|
function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {
|
||||||
if (event.key === 'Enter' || event.key === ' ') {
|
if (event.key === 'Enter' || event.key === ' ') {
|
||||||
showCustomPicker ? closeCustomPicker() : openCustomPicker()
|
if (showCustomPicker) {
|
||||||
|
closeCustomPicker()
|
||||||
|
} else {
|
||||||
|
openCustomPicker()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,9 @@ export default function EditMember({
|
||||||
<SelectPrivilege
|
<SelectPrivilege
|
||||||
value={privileges}
|
value={privileges}
|
||||||
handleChange={value => {
|
handleChange={value => {
|
||||||
value && handlePrivilegeChange(value.key)
|
if (value) {
|
||||||
|
handlePrivilegeChange(value.key)
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
canAddCollaborators={canAddCollaborators}
|
canAddCollaborators={canAddCollaborators}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -85,6 +85,7 @@
|
||||||
"@overleaf/redis-wrapper": "*",
|
"@overleaf/redis-wrapper": "*",
|
||||||
"@overleaf/settings": "*",
|
"@overleaf/settings": "*",
|
||||||
"@slack/webhook": "^7.0.2",
|
"@slack/webhook": "^7.0.2",
|
||||||
|
"@types/dateformat": "^5.0.2",
|
||||||
"@xmldom/xmldom": "^0.7.13",
|
"@xmldom/xmldom": "^0.7.13",
|
||||||
"accepts": "^1.3.7",
|
"accepts": "^1.3.7",
|
||||||
"ajv": "^8.12.0",
|
"ajv": "^8.12.0",
|
||||||
|
@ -251,8 +252,6 @@
|
||||||
"@types/recurly__recurly-js": "^4.22.0",
|
"@types/recurly__recurly-js": "^4.22.0",
|
||||||
"@types/sinon-chai": "^3.2.8",
|
"@types/sinon-chai": "^3.2.8",
|
||||||
"@types/uuid": "^9.0.8",
|
"@types/uuid": "^9.0.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
||||||
"@typescript-eslint/parser": "^7.8.0",
|
|
||||||
"@uppy/core": "^3.8.0",
|
"@uppy/core": "^3.8.0",
|
||||||
"@uppy/dashboard": "^3.7.1",
|
"@uppy/dashboard": "^3.7.1",
|
||||||
"@uppy/drag-drop": "^3.0.3",
|
"@uppy/drag-drop": "^3.0.3",
|
||||||
|
|
|
@ -134,7 +134,9 @@ async function processRows(rows) {
|
||||||
update,
|
update,
|
||||||
{ upsert: false }
|
{ upsert: false }
|
||||||
)
|
)
|
||||||
result.matchedCount && stats.db.matched++
|
if (result.matchedCount) {
|
||||||
|
stats.db.matched++
|
||||||
|
}
|
||||||
if (result.modifiedCount) {
|
if (result.modifiedCount) {
|
||||||
stats.db.updated++
|
stats.db.updated++
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
|
|
@ -3,8 +3,7 @@ import {
|
||||||
isDeletableProject,
|
isDeletableProject,
|
||||||
isLeavableProject,
|
isLeavableProject,
|
||||||
} from '../../../../../frontend/js/features/project-list/util/project'
|
} from '../../../../../frontend/js/features/project-list/util/project'
|
||||||
|
import moment from 'moment'
|
||||||
const moment = require('moment')
|
|
||||||
|
|
||||||
export const owner = {
|
export const owner = {
|
||||||
id: '624333f147cfd8002622a1d3',
|
id: '624333f147cfd8002622a1d3',
|
||||||
|
@ -38,7 +37,7 @@ const users = {
|
||||||
export const copyableProject = <Project>{
|
export const copyableProject = <Project>{
|
||||||
id: '62f17f594641b405ca2b3264',
|
id: '62f17f594641b405ca2b3264',
|
||||||
name: 'Starfleet Report (owner)',
|
name: 'Starfleet Report (owner)',
|
||||||
lastUpdated: moment().subtract(1, 'day').toDate(),
|
lastUpdated: moment().subtract(1, 'day').toISOString(),
|
||||||
lastUpdatedBy: users.picard,
|
lastUpdatedBy: users.picard,
|
||||||
accessLevel: 'owner',
|
accessLevel: 'owner',
|
||||||
source: 'owner',
|
source: 'owner',
|
||||||
|
@ -50,7 +49,7 @@ export const copyableProject = <Project>{
|
||||||
export const archiveableProject = <Project>{
|
export const archiveableProject = <Project>{
|
||||||
id: '62d6d3721357e20a682110d5',
|
id: '62d6d3721357e20a682110d5',
|
||||||
name: "Captain's logs (Invite & Read Only)",
|
name: "Captain's logs (Invite & Read Only)",
|
||||||
lastUpdated: moment().subtract(1, 'week').toDate(),
|
lastUpdated: moment().subtract(1, 'week').toISOString(),
|
||||||
lastUpdatedBy: users.picard,
|
lastUpdatedBy: users.picard,
|
||||||
accessLevel: 'readOnly',
|
accessLevel: 'readOnly',
|
||||||
source: 'invite',
|
source: 'invite',
|
||||||
|
@ -62,7 +61,7 @@ export const archiveableProject = <Project>{
|
||||||
export const trashedProject = <Project>{
|
export const trashedProject = <Project>{
|
||||||
id: '42f17f594641b405ca2b3265',
|
id: '42f17f594641b405ca2b3265',
|
||||||
name: 'Starfleet Report draft (owner & trashed)',
|
name: 'Starfleet Report draft (owner & trashed)',
|
||||||
lastUpdated: moment().subtract(2, 'year').toDate(),
|
lastUpdated: moment().subtract(2, 'year').toISOString(),
|
||||||
lastUpdatedBy: users.picard,
|
lastUpdatedBy: users.picard,
|
||||||
accessLevel: 'owner',
|
accessLevel: 'owner',
|
||||||
source: 'owner',
|
source: 'owner',
|
||||||
|
@ -74,7 +73,7 @@ export const trashedProject = <Project>{
|
||||||
export const archivedProject = <Project>{
|
export const archivedProject = <Project>{
|
||||||
id: '52f17f594641b405ca2b3266',
|
id: '52f17f594641b405ca2b3266',
|
||||||
name: 'Starfleet Report old (owner & archive)',
|
name: 'Starfleet Report old (owner & archive)',
|
||||||
lastUpdated: moment().subtract(1, 'year').toDate(),
|
lastUpdated: moment().subtract(1, 'year').toISOString(),
|
||||||
lastUpdatedBy: users.picard,
|
lastUpdatedBy: users.picard,
|
||||||
accessLevel: 'owner',
|
accessLevel: 'owner',
|
||||||
source: 'owner',
|
source: 'owner',
|
||||||
|
@ -86,7 +85,7 @@ export const archivedProject = <Project>{
|
||||||
export const trashedAndNotOwnedProject = <Project>{
|
export const trashedAndNotOwnedProject = <Project>{
|
||||||
id: '63d6d3721357e20a682110d5',
|
id: '63d6d3721357e20a682110d5',
|
||||||
name: "Captain's logs very old (Trashed & Read Only & Not Owned)",
|
name: "Captain's logs very old (Trashed & Read Only & Not Owned)",
|
||||||
lastUpdated: moment().subtract(11, 'year').toDate(),
|
lastUpdated: moment().subtract(11, 'year').toISOString(),
|
||||||
lastUpdatedBy: users.picard,
|
lastUpdatedBy: users.picard,
|
||||||
accessLevel: 'readOnly',
|
accessLevel: 'readOnly',
|
||||||
source: 'invite',
|
source: 'invite',
|
||||||
|
@ -105,7 +104,7 @@ export const projectsData: Array<Project> = [
|
||||||
{
|
{
|
||||||
id: '62b5cdf85212090c2244161c',
|
id: '62b5cdf85212090c2244161c',
|
||||||
name: 'Enterprise Security Analysis | Deflector Shields, Sensors, Tractor Beams, and Cloaking Devices (Invite & Edit)',
|
name: 'Enterprise Security Analysis | Deflector Shields, Sensors, Tractor Beams, and Cloaking Devices (Invite & Edit)',
|
||||||
lastUpdated: moment().subtract(1, 'month').toDate(),
|
lastUpdated: moment().subtract(1, 'month').toISOString(),
|
||||||
lastUpdatedBy: users.worf,
|
lastUpdatedBy: users.worf,
|
||||||
accessLevel: 'readWrite',
|
accessLevel: 'readWrite',
|
||||||
source: 'invite',
|
source: 'invite',
|
||||||
|
@ -116,7 +115,7 @@ export const projectsData: Array<Project> = [
|
||||||
{
|
{
|
||||||
id: '624380431c2e40006c59b922',
|
id: '624380431c2e40006c59b922',
|
||||||
name: 'VISOR Sensors (Link Sharing & Edit)',
|
name: 'VISOR Sensors (Link Sharing & Edit)',
|
||||||
lastUpdated: moment().subtract(2, 'months').toDate(),
|
lastUpdated: moment().subtract(2, 'months').toISOString(),
|
||||||
lastUpdatedBy: users.laforge,
|
lastUpdatedBy: users.laforge,
|
||||||
accessLevel: 'readAndWrite',
|
accessLevel: 'readAndWrite',
|
||||||
source: 'token',
|
source: 'token',
|
||||||
|
@ -127,7 +126,7 @@ export const projectsData: Array<Project> = [
|
||||||
{
|
{
|
||||||
id: '62f51b31f6f4c60027e8935f',
|
id: '62f51b31f6f4c60027e8935f',
|
||||||
name: 'United Federation of Planets (Link Sharing & View Only)',
|
name: 'United Federation of Planets (Link Sharing & View Only)',
|
||||||
lastUpdated: moment().subtract(2, 'year').toDate(),
|
lastUpdated: moment().subtract(2, 'year').toISOString(),
|
||||||
lastUpdatedBy: null,
|
lastUpdatedBy: null,
|
||||||
accessLevel: 'readOnly',
|
accessLevel: 'readOnly',
|
||||||
source: 'token',
|
source: 'token',
|
||||||
|
|
|
@ -3,8 +3,8 @@ import {
|
||||||
GroupSubscription,
|
GroupSubscription,
|
||||||
RecurlySubscription,
|
RecurlySubscription,
|
||||||
} from '../../../../../types/subscription/dashboard/subscription'
|
} from '../../../../../types/subscription/dashboard/subscription'
|
||||||
|
import dateformat from 'dateformat'
|
||||||
|
|
||||||
const dateformat = require('dateformat')
|
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
const oneYearFromToday = new Date().setFullYear(today.getFullYear() + 1)
|
const oneYearFromToday = new Date().setFullYear(today.getFullYear() + 1)
|
||||||
const nextPaymentDueAt = dateformat(oneYearFromToday, 'dS mmmm yyyy')
|
const nextPaymentDueAt = dateformat(oneYearFromToday, 'dS mmmm yyyy')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import isInFreeTrial from '../../../../../frontend/js/features/subscription/util/is-in-free-trial'
|
import isInFreeTrial from '../../../../../frontend/js/features/subscription/util/is-in-free-trial'
|
||||||
const dateformat = require('dateformat')
|
import dateformat from 'dateformat'
|
||||||
|
|
||||||
describe('isInFreeTrial', function () {
|
describe('isInFreeTrial', function () {
|
||||||
it('returns false when no date sent', function () {
|
it('returns false when no date sent', function () {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import showDowngradeOption from '../../../../../frontend/js/features/subscription/util/show-downgrade-option'
|
import showDowngradeOption from '../../../../../frontend/js/features/subscription/util/show-downgrade-option'
|
||||||
const dateformat = require('dateformat')
|
import dateformat from 'dateformat'
|
||||||
|
|
||||||
describe('showDowngradeOption', function () {
|
describe('showDowngradeOption', function () {
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export type Nullable<T> = T | null
|
export type Nullable<T> = T | null
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-empty-object-type
|
||||||
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}
|
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}
|
||||||
|
|
||||||
type DeepReadonlyObject<T> = {
|
type DeepReadonlyObject<T> = {
|
||||||
|
|
Loading…
Reference in a new issue