Skip to content

Commit

Permalink
chore: fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Jul 8, 2022
1 parent 2b9541d commit 475b4bb
Show file tree
Hide file tree
Showing 182 changed files with 1,491 additions and 1,285 deletions.
25 changes: 0 additions & 25 deletions .eslintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: [require.resolve("@tsed/config/eslint/web")]
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"test": "lerna run test --stream",
"test:e2e": "lerna run test:e2e",
"test:coverage:update": "lerna run test:coverage:update --stream",
"lint": "yarn eslint --config .eslintrc --quiet \"packages/**/*.{ts,tsx,js,jsx}\"",
"lint:fix": "yarn lint --fix",
"lint": "lerna run lint --stream",
"lint:fix": "lerna run lint:fix --stream",
"prettier": "prettier '**/*.{ts,js,json,md,yml,yaml}' --write",
"build": "monorepo build",
"publish": "monorepo publish --dry-run",
Expand Down
13 changes: 13 additions & 0 deletions packages/config/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**/node_modules
docs
docs-references
**/lib
**/build
**/dist
**/coverage
**/.nyc_output
**/node_modules
*-lock.json
*.lock
benchmarks.*
**/generated
1 change: 1 addition & 0 deletions packages/config/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("./eslint/node.js");
10 changes: 10 additions & 0 deletions packages/config/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 140,
"singleQuote": false,
"jsxSingleQuote": true,
"semi": true,
"tabWidth": 2,
"bracketSpacing": true,
"arrowParens": "always",
"trailingComma": "none"
}
40 changes: 40 additions & 0 deletions packages/config/eslint/node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
parser: "@typescript-eslint/parser",
extends: ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
plugins: ["workspaces", "simple-import-sort"],
parserOptions: {
ecmaVersion: 2020,
sourceType: "module"
},
env: {
node: true,
es6: true
},
rules: {
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-unused-vars": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"workspaces/no-absolute-imports": "error"
},
overrides: [
{
files: ["**/*.spec.ts", "**/test/**", "**/__mock__/**"],
rules: {
"workspaces/no-absolute-imports": 0
}
},
{
files: ["**/*.js"],
rules: {
"@typescript-eslint/no-var-requires": 0
}
}
]
};
10 changes: 10 additions & 0 deletions packages/config/eslint/web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
extends: ["react-app", "react-app/jest", "plugin:jsx-a11y/strict"],
plugins: ["workspaces", "prettier", "simple-import-sort"],
rules: {
"prettier/prettier": "error",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"workspaces/no-absolute-imports": "error"
}
};
2 changes: 0 additions & 2 deletions packages/config/jest/cssTransform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/en/webpack.html

Expand Down
2 changes: 0 additions & 2 deletions packages/config/jest/fileTransform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


const path = require("path");
const camelcase = require("camelcase");

Expand Down
46 changes: 23 additions & 23 deletions packages/config/jest/jest.web.config.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
roots: ['<rootDir>/src'],
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!src/**/*.d.ts', '!src/mocks/**', '!src/__mock__/**'],
roots: ["<rootDir>/src"],
collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}", "!src/**/*.d.ts", "!src/mocks/**", "!src/__mock__/**"],
coveragePathIgnorePatterns: [],
testEnvironment: 'jsdom',
setupFilesAfterEnv: [require.resolve('./setupTest.js')],
testEnvironment: "jsdom",
setupFilesAfterEnv: [require.resolve("./setupTest.js")],
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest', require('./swc.web.json')],
'^.+\\.css$': require.resolve('./cssTransform.js'),
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': require.resolve('./fileTransform.js')
"^.+\\.(t|j)sx?$": ["@swc/jest", require("./swc.web.json")],
"^.+\\.css$": require.resolve("./cssTransform.js"),
"^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": require.resolve("./fileTransform.js")
},
transformIgnorePatterns: [ '^.+\\.module\\.(css|sass|scss)$'],
modulePaths: ['<rootDir>/src'],
transformIgnorePatterns: ["^.+\\.module\\.(css|sass|scss)$"],
modulePaths: ["<rootDir>/src"],
moduleNameMapper: {
'^react-native$': 'react-native-web',
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy'
"^react-native$": "react-native-web",
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
},
moduleFileExtensions: [
// Place tsx and ts to beginning as suggestion from Jest team
// https://jestjs.io/docs/configuration#modulefileextensions-arraystring
'tsx',
'ts',
'web.js',
'js',
'web.ts',
'web.tsx',
'json',
'web.jsx',
'jsx',
'node'
"tsx",
"ts",
"web.js",
"js",
"web.ts",
"web.tsx",
"json",
"web.jsx",
"jsx",
"node"
],
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],
coverageReporters: ["clover", "json", "lcov", ["text", { skipFull: true }], "json-summary"]
}
};
20 changes: 10 additions & 10 deletions packages/config/jest/setupTest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@testing-library/jest-dom/extend-expect'
import "@testing-library/jest-dom/extend-expect";

window.matchMedia = (query) => ({
matches: false,
Expand All @@ -9,21 +9,21 @@ window.matchMedia = (query) => ({
dispatchEvent: jest.fn(),
addListener: jest.fn(),
removeListener: jest.fn()
})
});

Object.defineProperty(URL, 'createObjectURL', {
Object.defineProperty(URL, "createObjectURL", {
writable: true,
value: jest.fn()
})
});

if (typeof window !== 'undefined') {
window.scrollTo = jest.fn()
if (typeof window !== "undefined") {
window.scrollTo = jest.fn();

jest.mock(
'react-svg',
"react-svg",
() =>
function Svg () {
return ''
function Svg() {
return "";
}
)
);
}
8 changes: 6 additions & 2 deletions packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"author": "Romain Lenzotti",
"license": "MIT",
"private": true,
"scripts": {},
"scripts": {
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "yarn lint --fix"
},
"bin": {
"write-coverage": "./bin/write-coverage.js"
},
Expand All @@ -17,4 +20,5 @@
},
"dependencies": {},
"peerDependencies": {}
}
}

10 changes: 5 additions & 5 deletions packages/config/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module.exports = {
plugins: {
'postcss-import': {},
'postcss-url': {},
'@tailwindcss/nesting': {},
"postcss-import": {},
"postcss-url": {},
"@tailwindcss/nesting": {},
tailwindcss: {
config: require('@tsed/tailwind')
config: require("@tsed/tailwind")
},
autoprefixer: {}
}
}
};
13 changes: 13 additions & 0 deletions packages/react-formio-container/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**/node_modules
docs
docs-references
**/lib
**/build
**/dist
**/coverage
**/.nyc_output
**/node_modules
*-lock.json
*.lock
benchmarks.*
**/generated
6 changes: 6 additions & 0 deletions packages/react-formio-container/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: [require.resolve("@tsed/config/eslint/web")],
rules: {
"import/no-anonymous-default-export": 0
}
};
6 changes: 3 additions & 3 deletions packages/react-formio-container/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
...require('@tsed/config/jest/jest.web.config.js'),
...require("@tsed/config/jest/jest.web.config.js"),
coverageThreshold: {
global: require('./coverage.json')
global: require("./coverage.json")
}
}
};
4 changes: 3 additions & 1 deletion packages/react-formio-container/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"source": "src/index.tsx",
"license": "MIT",
"scripts": {
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "yarn lint --fix",
"test": "cross-env NODE_ENV=test jest --coverage",
"test:coverage:update": "write-coverage",
"build": "microbundle --no-compress --format modern,cjs --jsx React.createElement",
Expand Down Expand Up @@ -88,4 +90,4 @@
}
},
"dependencies": {}
}
}
5 changes: 3 additions & 2 deletions packages/react-formio-container/src/formio.container.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { Route, Switch, useParams } from "react-router";

import { FormioContainerOptions } from "./interfaces/FormioContainerOptions";
import { FormView } from "./views/form.view";
import { FormsView } from "./views/forms.view";
Expand Down Expand Up @@ -32,10 +33,10 @@ export function FormioContainer(props: FormioContainerOptions) {
return (
<Switch>
<Route path={options.basePath} exact={true}>
<FormsView {...options as any} />
<FormsView {...(options as any)} />
</Route>
<Route path={[options.basePath, ":formId", ":formAction?"].join("/")}>
<FormView {...options as any} />
<FormView {...(options as any)} />
</Route>
</Switch>
);
Expand Down
Loading

0 comments on commit 475b4bb

Please sign in to comment.