chore: upgrade eslint config

This commit is contained in:
Dylan Piercey 2021-11-03 15:50:40 -07:00
parent 74e0f34a0a
commit 638202d643
No known key found for this signature in database
GPG Key ID: 6E196D1D87447EA1
10 changed files with 37 additions and 134 deletions

View File

@ -1,6 +1,6 @@
*actual*
*expected*
.vscode
.nyc_output
node_modules
coverage
dist
__snapshots__

View File

@ -2,20 +2,14 @@
"root": true,
"extends": ["eslint:recommended", "prettier"],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": false
}
},
"rules": {
"no-console": "off"
"impliedStrict": true
},
"env": {
"browser": true,
"node": true,
"es6": true,
"mocha": true
"mocha": true,
"es2020": true,
"browser": true
},
"overrides": [
{
@ -27,13 +21,12 @@
"prettier"
],
"rules": {
"no-prototype-builtins": "off",
"no-constant-condition": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-var-requires": "off"
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-namespace": "off"
}
}
]

128
.gitignore vendored
View File

@ -1,117 +1,19 @@
### Project ###
*.marko.js
*actual*
# Editor
*.sublime*
.vscode
# OSX
*.DS_Store
# NPM
node_modules
npm-debug.log
# Build
dist
*.actual.*
*.tsbuildinfo
### Node ###
# Logs
logs
*.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
# Coverage
.nyc_output
# Dependency directories
node_modules
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn
.yarn-integrity
# Npm
package-lock.json
# dotenv environment variables file
.env
.env.test
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
### OS ###
# Linux
*~
.fuse_hidden*
.directory
.Trash-*
.nfs*
# Mac
.DS_Store
.AppleDouble
.LSOverride
._*
Icon
# Windows
*[Tt]humbs*.db*
[Dd]esktop.ini
*.stackdump
*.lnk
### EDITOR ###
# VisualStudioCode
.vscode
.history
# JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
*.iml
*.ipr
*.iws
modules.xml
.idea
# SublimeText
*.cache
*.sublime-*
Package Control.*
oscrypto-ca-bundle.crt
# TextMate
*.tmproj
*.tmproject
tmtags
# Vim
*.swp
*.vim
.netrwhist
coverage

View File

@ -1,5 +0,0 @@
{
"*.{json,md}": ["prettier --write"],
"*.{js,ts}": ["eslint --fix", "prettier --write"],
"./{,packages/*/}package.json": ["fixpack"]
}

5
.lintstagedrc.json Normal file
View File

@ -0,0 +1,5 @@
{
"*.ts": ["eslint --fix", "prettier --write"],
"*{.js,.json,.md,.yml,rc}": ["prettier --write"],
"./{,packages/*/}package.json": ["fixpack"]
}

View File

@ -69,6 +69,7 @@ export function init(runtimeId = "M" /* [a-zA-Z0-9]+ */) {
const token = nodeValue[runtimeLength];
const data = nodeValue.slice(runtimeLength + 1);
if (token === HydrateSymbols.SCOPE_OFFSET) {
// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
const [offset, scopeId, index] = data.split(" ");
if (scopeId !== currentScope[ScopeOffsets.ID]) {
@ -93,6 +94,7 @@ export function init(runtimeId = "M" /* [a-zA-Z0-9]+ */) {
}
currentScope[ScopeOffsets.START_NODE] = currentNode;
} else if (token === HydrateSymbols.SCOPE_END) {
// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
if (data !== currentScope[ScopeOffsets.ID]) {
throw new Error("SCOPE_END_MISMATCH: " + nodeValue);
@ -101,6 +103,7 @@ export function init(runtimeId = "M" /* [a-zA-Z0-9]+ */) {
currentScope[ScopeOffsets.END_NODE] = currentNode;
currentOffset = stack.pop() as number;
currentScope = scopeLookup.get(stack.pop() as string)!;
// eslint-disable-next-line no-constant-condition
} else if ("MARKO_DEBUG") {
throw new Error("MALFORMED MARKER: " + nodeValue);
}

View File

@ -64,6 +64,7 @@ export function dynamicTag(
: { renderBody, ...input }
: input
);
// eslint-disable-next-line no-constant-condition
} else if ("MARKO_DEBUG") {
throw new Error(`Invalid renderer passed for dynamic tag: ${tag}`);
}

View File

@ -247,6 +247,7 @@ const lastIndex = new WeakMap();
export function markScopeOffset(index: number, scope: Scope) {
const offset = index - (lastIndex.get(scope) || 0);
lastIndex.set(scope, index);
// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
return `<!${runtimeId}${HydrateSymbols.SCOPE_OFFSET}${offset} ${
scope[ScopeOffsets.ID]
@ -262,6 +263,7 @@ export function markScopeStart(scope: Scope) {
}
export function markScopeEnd(scope: Scope) {
// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
return `<!${runtimeId}${HydrateSymbols.SCOPE_END}${
scope[ScopeOffsets.ID]

View File

@ -323,6 +323,7 @@ function trackInputReference(
let curPath = identifier as t.NodePath<t.Node>;
let curAccessor = accessor;
// eslint-disable-next-line no-constant-condition
while (true) {
const parentPath = curPath.parentPath!;

View File

@ -47,6 +47,7 @@ function getRuntime<T extends t.Node>(
function getRuntimePath<T extends t.Node>(path: t.NodePath<T>, output: string) {
const { optimize } = getMarkoOpts(path);
return `@marko/runtime-fluurt/${
// eslint-disable-next-line no-constant-condition
"MARKO_SRC" ? "src" : optimize ? "dist" : "dist/debug"
}/${output}`;
}