generated from Klectr/KTemplate
make it so underscore ignores unused vars
This commit is contained in:
parent
a506da11ad
commit
441269d435
@ -23,6 +23,18 @@ export default [
|
|||||||
rules: {
|
rules: {
|
||||||
"react/react-in-jsx-scope": "off",
|
"react/react-in-jsx-scope": "off",
|
||||||
"react/no-unknown-property": "off",
|
"react/no-unknown-property": "off",
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
args: "all",
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
caughtErrors: "all",
|
||||||
|
caughtErrorsIgnorePattern: "^_",
|
||||||
|
destructuredArrayIgnorePattern: "^_",
|
||||||
|
varsIgnorePattern: "^_",
|
||||||
|
ignoreRestSiblings: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -7,11 +7,13 @@ import { updateLocalStorage } from "../../utils/localStorage"
|
|||||||
import { Tooltip } from "./Tooltip"
|
import { Tooltip } from "./Tooltip"
|
||||||
import { defaultClassName } from "./utils"
|
import { defaultClassName } from "./utils"
|
||||||
|
|
||||||
|
type legacySupportTypes = { type: CardTypes | string }
|
||||||
|
|
||||||
export function ImportButton() {
|
export function ImportButton() {
|
||||||
|
|
||||||
function _handleImport() {
|
function _handleImport() {
|
||||||
// guard clause to prevent overwriting existing cards
|
// guard clause to prevent overwriting existing cards
|
||||||
if (images.images.value || notes.notes.value) {
|
if (Object.keys(images.images.value).length || Object.keys(notes.notes.value).length) {
|
||||||
const isConfirmed = confirm("Are you sure you want to overwrite your existing cards?")
|
const isConfirmed = confirm("Are you sure you want to overwrite your existing cards?")
|
||||||
if (!isConfirmed) return
|
if (!isConfirmed) return
|
||||||
}
|
}
|
||||||
@ -32,30 +34,22 @@ export function ImportButton() {
|
|||||||
let content = readerEvent.target?.result;
|
let content = readerEvent.target?.result;
|
||||||
// get only the base64 parts and not any identifiers
|
// get only the base64 parts and not any identifiers
|
||||||
content = (content as string).split(',')[1]
|
content = (content as string).split(',')[1]
|
||||||
const data: Record<string, Card<CardTypes>> = convertBase64ToJson(content)
|
const data: Record<string, Omit<Card<CardTypes>, 'type'> & legacySupportTypes> = convertBase64ToJson(content)
|
||||||
console.log(data)
|
|
||||||
for (const key in data) {
|
for (const key in data) {
|
||||||
const item = data[key]
|
const item = data[key]
|
||||||
const { id, ...rest } = item
|
const { id: _, ...rest } = item
|
||||||
console.log(id, rest)
|
if (item.type === CardTypes.IMAGES || item.type == 'image') {
|
||||||
switch (item.type) {
|
|
||||||
case CardTypes.IMAGES:
|
|
||||||
console.log("adding image: ", rest)
|
|
||||||
images.addImage(rest as ImageCardType)
|
images.addImage(rest as ImageCardType)
|
||||||
break;
|
continue
|
||||||
case CardTypes.NOTES:
|
} else if (item.type === CardTypes.NOTES || item.type === 'note') {
|
||||||
notes.addNote(rest as NoteCardType)
|
notes.addNote(rest as NoteCardType)
|
||||||
break;
|
continue
|
||||||
case CardTypes.TEXTS:
|
} else if (item.type === CardTypes.TEXTS || item.type === 'text') {
|
||||||
texts.addText(rest as TextCardType)
|
texts.addText(rest as TextCardType)
|
||||||
break;
|
continue
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("images: ", images.images.value)
|
|
||||||
|
|
||||||
updateLocalStorage(CardTypes.NOTES, notes.notes).notify()
|
updateLocalStorage(CardTypes.NOTES, notes.notes).notify()
|
||||||
updateLocalStorage(CardTypes.IMAGES, images.images).notify()
|
updateLocalStorage(CardTypes.IMAGES, images.images).notify()
|
||||||
updateLocalStorage(CardTypes.TEXTS, texts.texts).notify()
|
updateLocalStorage(CardTypes.TEXTS, texts.texts).notify()
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"noUnusedLocals": false,
|
||||||
|
"noUnusedParameters": false,
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
@ -15,8 +17,6 @@
|
|||||||
|
|
||||||
/* Linting */
|
/* Linting */
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
|
||||||
"noUnusedParameters": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"jsx": "preserve"
|
"jsx": "preserve"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user