-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add eslint rules and lint project (#56)
* Add lint config and run format * Move contributing.md to root
- Loading branch information
Showing
34 changed files
with
196 additions
and
10,354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
cd app && npm run format | ||
cd app && npm run lint && npm run format |
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// License: MIT | ||
// Author: Anton Medvedev <[email protected]> | ||
// Source: https://github.com/antonmedv/finder | ||
// @ts-ignore | ||
// @ts-expect-error - No declaration | ||
import { generate, parse } from '../changes/csstree.esm.js'; | ||
|
||
type Knot = { | ||
|
@@ -82,7 +82,7 @@ function bottomUpSearch( | |
fallback?: () => Path | null, | ||
): Path | null { | ||
let path: Path | null = null; | ||
let stack: Knot[][] = []; | ||
const stack: Knot[][] = []; | ||
let current: Element | null = input; | ||
let i = 0; | ||
while (current) { | ||
|
@@ -115,7 +115,7 @@ function bottomUpSearch( | |
level = [nthChild(level[0], nth)]; | ||
} | ||
} | ||
for (let node of level) { | ||
for (const node of level) { | ||
node.level = i; | ||
} | ||
stack.push(level); | ||
|
@@ -142,7 +142,7 @@ function findUniquePath(stack: Knot[][], fallback?: () => Path | null): Path | n | |
if (paths.length > config.threshold) { | ||
return fallback ? fallback() : null; | ||
} | ||
for (let candidate of paths) { | ||
for (const candidate of paths) { | ||
if (unique(candidate)) { | ||
return candidate; | ||
} | ||
|
@@ -278,7 +278,7 @@ function notEmpty<T>(value: T | null | undefined): value is T { | |
|
||
function* combinations(stack: Knot[][], path: Knot[] = []): Generator<Knot[]> { | ||
if (stack.length > 0) { | ||
for (let node of stack[0]) { | ||
for (const node of stack[0]) { | ||
yield* combinations(stack.slice(1, stack.length), path.concat(node)); | ||
} | ||
} else { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { fixupConfigRules } from '@eslint/compat'; | ||
import pluginJs from '@eslint/js'; | ||
import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js'; | ||
import globals from 'globals'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
export default [ | ||
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] }, | ||
{ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } }, | ||
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } }, | ||
pluginJs.configs.recommended, | ||
...tseslint.configs.recommended, | ||
...fixupConfigRules(pluginReactConfig), | ||
{ | ||
ignores: [ | ||
'node_modules/', | ||
'dist/', | ||
'dist-electron/', | ||
'release/', | ||
'src/out/', | ||
'electron/preload/webview/changes/csstree.esm.js', | ||
], | ||
}, | ||
{ | ||
rules: { | ||
curly: ['error', 'all'], | ||
'prefer-const': 'warn', | ||
'react/react-in-jsx-scope': 'off', | ||
'react/jsx-uses-react': 'off', | ||
'react/no-unknown-property': 'off', | ||
'react/prop-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-unused-vars': 'warn', | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.