Skip to content

Commit

Permalink
initialise project
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitskvmdam committed Aug 30, 2021
1 parent dcfe520 commit bc9a0cd
Show file tree
Hide file tree
Showing 12 changed files with 18,170 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
node_modules
dist

# config files
*.config.ts

# test files
*.test.ts
*.test.tsx
*.spec.ts
*.spec.tsx

# stories files
*.stories.tsx
*.stories.ts
*.stories.jsx
*.stories.js
51 changes: 51 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"env": {
"node": true,
"browser": true,
"jest": true
},
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:eslint-comments/recommended",
"plugin:jest/recommended",
"plugin:promise/recommended",
"plugin:unicorn/recommended",
"prettier"
],
"plugins": [
"react",
"@typescript-eslint",
"eslint-comments",
"jest",
"promise",
"unicorn"
],
"rules": {
"no-prototype-builtins": "off",
"@typescript-eslint/semi": 0,
"@typescript-eslint/member-delimiter-style": 0,
"@typescript-eslint/no-explicit-any": 0,
"react/jsx-indent": 0,
"react/jsx-indent-props": 0,
"unicorn/no-null": 0,
"react/require-default-props": 0,
"global-require": 0,
"react/jsx-props-no-spreading": 0,
"@typescript-eslint/ban-ts-ignore": 0,
"comma-dangle": 0,
"max-len": [
"error",
{
"code": 80
}
],
"import/prefer-default-export": "off",
"import/extensions": 0,
"unicorn/prevent-abbreviations": 0
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.DS_Store
.vscode
dist
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 4,
"singleQuote": true,
"endOfLine": "crlf",
"semi": false,
"printWidth": 80
}
10 changes: 10 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials"
]
}
9 changes: 9 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
33 changes: 33 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = (api) => {
const isTest = api.env('test')

const ignore = [
'src/**/*.stories.ts',
'src/**/*.stories.tsx',
'src/**/*.stories.js',
'src/**/*.stories.jsx',
]

if (!isTest) {
/**
* If environment is not test then we have
* to exclude exclude test files from being
* compiled
*/
ignore.push('src/**/*.test.tsx')
ignore.push('src/**/*.test.ts')
ignore.push('src/**/*.test.jsx')
ignore.push('src/**/*.test.js')
ignore.push('**/__tests__/*')
ignore.push('**/__mocks__/*')
}

return {
presets: ['@babel/env', '@babel/typescript'],
plugins: [
'@babel/proposal-class-properties',
'@babel/proposal-object-rest-spread',
],
ignore: ignore,
}
}
31 changes: 31 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,

// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: ['src/**/*.{ts,tsx}'],

// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',

// An array of file extensions your modules use
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],

// The test environment that will be used for testing
testEnvironment: 'jsdom',

// The glob patterns Jest uses to detect test files
testMatch: ['**/__tests__/**/*.ts?(x)', '**/?(*.)+(spec|test).ts?(x)'],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['\\\\node_modules\\\\', '<rootDir>/dist/'],

// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
testURL: 'http://localhost',

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
transformIgnorePatterns: ['<rootDir>/node_modules/'],

// Indicates whether each individual test should be reported during the run
verbose: true,
}
Loading

0 comments on commit bc9a0cd

Please sign in to comment.