Skip to content

Commit

Permalink
build: Clean up the root config files
Browse files Browse the repository at this point in the history
  • Loading branch information
juliencrn committed Sep 19, 2022
1 parent 8c341a4 commit 73bdafc
Show file tree
Hide file tree
Showing 15 changed files with 17,831 additions and 52,413 deletions.
92 changes: 92 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"extends": [
"plugin:react-hooks/recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended"
],
"plugins": ["react", "simple-import-sort", "prettier", "jsx-a11y"],
"env": {
"browser": true,
"es6": true,
"node": true
},
"settings": {
"react": {
"version": "16.8.0"
}
},
"rules": {
"prettier/prettier": "warn",
"react/prop-types": "off",
"sort-imports": "off",
"import/order": "off",
"simple-import-sort/exports": "warn",
"simple-import-sort/imports": [
"warn",
{
"groups": [
["^\\u0000"], // side effect (E.g."import "normalize.css"")
["^react$"],
["^[^.]"], // Libs
["^../|^~/|^./"]
]
}
]
},
"overrides": [
// Typescript related rules
{
"files": ["*.ts", "*.tsx"],
"plugins": ["@typescript-eslint/eslint-plugin"],
"extends": ["plugin:@typescript-eslint/recommended"],
"rules": {
// We should absolutely avoid using ts-ignore, but it"s not always possible.
// particular when a dependencies types are incorrect.
"@typescript-eslint/ban-ts-comment": [
"warn",
{ "ts-ignore": "allow-with-description" }
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
]
}
},

// Track tree-shaking potential error in the lib
{
"files": ["./src/**/!(*.test|*.spec).ts"],
"plugins": ["tree-shaking"],
"rules": {
"tree-shaking/no-side-effects-in-initialization": 2
}
},

// Specials rules for testing
{
"extends": ["plugin:jest/recommended"],
"files": ["**/*.test.ts"],
"plugins": ["jest"],
"env": {
"jest": true
},
"rules": {
// you should turn the original rule off *only* for test files
"@typescript-eslint/unbound-method": "off",
"jest/unbound-method": "error"
}
}
]
}
92 changes: 0 additions & 92 deletions .eslintrc.js

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ npm-debug.log*

# Compiled stuff
dist
esm
public
generated

# Coverage
coverage
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.js → .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
{
"arrowParens": "avoid",
"semi": false,
"printWidth": 80,
Expand Down
9 changes: 5 additions & 4 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ const ignoreDirs = [
'public/',
'generators/',
'generated/',
'site/',
'website/',
'tests/',
]

const config: Config.InitialOptions = {
testEnvironment: 'jsdom',
roots: packages,
transform: {
'^.+\\.[jt]sx?$': `<rootDir>/jest-preprocess.js`,
'^.+\\.[jt]sx?$': `<rootDir>/tests/jest-preprocess.js`,
},
moduleNameMapper: {
'.+\\.(css|styl|less|sass|scss)$': `identity-obj-proxy`,
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': `<rootDir>/__mocks__/file-mock.js`,
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': `<rootDir>/tests/file-mock.js`,
},
testPathIgnorePatterns: ignoreDirs,
transformIgnorePatterns: [`node_modules/(?!(gatsby)/)`],
Expand All @@ -33,7 +34,7 @@ const config: Config.InitialOptions = {
__PATH_PREFIX__: ``,
},
testURL: `http://localhost`,
setupFiles: [`<rootDir>/loadershim.js`],
setupFiles: [`<rootDir>/tests/loadershim.js`],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.([tj]sx?)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
}
Expand Down
Loading

0 comments on commit 73bdafc

Please sign in to comment.