Skip to content

Commit

Permalink
Fixes liferay#1605 - Update configuration for react+ts
Browse files Browse the repository at this point in the history
  • Loading branch information
bryceosterhaus committed Mar 11, 2019
1 parent caae62a commit 42f87b1
Show file tree
Hide file tree
Showing 14 changed files with 4,301 additions and 1,936 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

9 changes: 8 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
clay-css
clay-css
clay-charts
clayui.com
build
coverage
lib
node_modules
packages/generator-clay-component/app/templates
29 changes: 0 additions & 29 deletions .eslintrc

This file was deleted.

87 changes: 87 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"extends": "liferay",
"plugins": [
"notice",
"no-for-of-loops",
"react",
"react-hooks",
"sort-destructure-keys",
"sort-imports-es6-autofix"
],
"rules": {
"comma-dangle": [2, "always"],
"default-case": 2,
"eol-last": [2, "never"],
"max-len": 0,
"no-console": 2,
"no-for-of-loops/no-for-of-loops": 2,
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
"no-return-assign": [2, "always"],
"no-undef": 2,
"no-underscore-dangle": [
2,
{
"allowAfterThis": true,
"enforceInMethodNames": true
}
],
"no-unused-vars": [
2,
{
"args": "after-used",
"ignoreRestSiblings": false,
"vars": "all"
}
],
"notice/notice": [
"error",
{
"template": "/**\n * © <%= YEAR %> Liferay, Inc. <https://liferay.com>\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n"
}
],
"object-shorthand": 2,
"prefer-const": 2,
"prefer-template": 2,
"quote-props": [2, "as-needed"],
"quotes": [2, "single", "avoid-escape"],
"react-hooks/rules-of-hooks": "error",
"react/jsx-boolean-value": 2,
"react/jsx-handler-names": 2,
"react/jsx-key": 2,
"react/jsx-no-bind": 2,
"react/jsx-no-literals": 2,
"react/jsx-sort-props": 2,
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": 2,
"require-jsdoc": 0,
"sort-destructure-keys/sort-destructure-keys": 2,
"sort-imports-es6-autofix/sort-imports-es6": [
2,
{
"ignoreCase": true,
"ignoreMemberSort": false,
"memberSyntaxSortOrder": ["none", "all", "single", "multiple"]
}
],
"sort-keys": [
2,
"asc",
{
"caseSensitive": false
}
],
"sort-vars": 2
}
}
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
clay-charts
clayui.com
bower_components
build
coverage
lib
node_modules
package-lock.json
yarn.lock
yarn.lock
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"bracketSpacing": false,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "es5",
"useTabs": true
}
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
after_success: npm run coveralls
after_success: yarn run coveralls

before_install:
- nvm install 8
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.10.1
- export PATH=$HOME/.yarn/bin:$PATH
- npm install -g lerna@3.4.0
- yarn add -g lerna@3.4.0

branches:
except:
Expand All @@ -22,6 +22,6 @@ jdk:
language: java

script:
- npm run checkFormat
- npm run lint
- npm run jest
- yarn run checkFormat
- yarn run lint
- yarn run test
19 changes: 19 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* © 2019 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*/

module.exports = api => {
api.cache(true);

return {
ignore: ['node_modules', '**/__snapshots__/**', '**/__tests__/**',],
presets: [
'@babel/env',
'@babel/preset-react',
'@babel/preset-typescript',
],
sourceMaps: true,
};
};
5 changes: 0 additions & 5 deletions copyright.js

This file was deleted.

22 changes: 22 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* © 2019 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*/

module.exports = {
collectCoverage: true,
coverageReporters: ['json', 'lcov',],
moduleFileExtensions: ['ts', 'tsx', 'js', 'json',],
resolver: `${__dirname}/scripts/jest-clay-lerna-resolver`,
setupFiles: [`${__dirname}/scripts/setupTests.js`,],
testMatch: [
`${process.cwd()}/**/__tests__/**/*.[jt]s?(x)`,
`${process.cwd()}/**/?(*.)+(spec|test).[jt]s?(x)`,
],
testPathIgnorePatterns: ['browserslist-config-clay', 'fixtures', 'lib',],
transform: {
'.(ts|tsx)': 'ts-jest',
},
transformIgnorePatterns: ['<rootDir>.*(node_modules)(?!.*clay.*).*$',],
};
66 changes: 32 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,56 @@
"checkFormat": "npm run prettier -- --list-different",
"coveralls": "node node_modules/coveralls/bin/coveralls.js < coverage/lcov.info",
"format": "npm run prettier -- --write",
"jest": "cross-env NODE_ENV=test jest",
"lerna": "lerna bootstrap -- --no-optional --no-package-lock",
"link": "lerna run link",
"lint": "eslint packages/**/*.js examples/**/*.js scripts/**/*.js",
"pa11y": "pa11y-ci ./packages/clay-*/demos/a11y.html",
"prettier": "prettier-eslint packages/**/**/*.js examples/**/**/*.js scripts/**/**/*.js",
"start": "http-server . -p 4000",
"test": "npm run build && npm run jest && npm run pa11y",
"lint": "eslint '**/*.{js,ts,tsx}'",
"prettier": "prettier-eslint '**/*.{js,ts,tsx}'",
"test": "jest",
"site": "cd clayui.com && npm run build && npm run serve"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.1",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.0.0",
"@types/classnames": "^2.2.7",
"@types/jest": "^23.3.5",
"@types/react": "^16.8.0",
"@types/react-dom": "^16.8.0",
"@types/react-test-renderer": "^16.8.0",
"@typescript-eslint/parser": "^1.4.0",
"awesome-typescript-loader": "^5.2.1",
"clay-css": "^2.8.3",
"coveralls": "^3.0.0",
"cross-env": "^5.1.3",
"css-loader": "^2.1.0",
"eslint": "^4.10.0",
"eslint-config-liferay": "^2.0.8",
"eslint-plugin-no-for-of-loops": "1.0.0",
"eslint-plugin-notice": "^0.7.7",
"eslint-plugin-react": "^7.11.1",
"http-server": "^0.9.0",
"husky": "^0.14.2",
"jest": "^20.0.4",
"eslint-plugin-react-hooks": "^1.0.2",
"eslint-plugin-sort-destructure-keys": "^1.1.0",
"eslint-plugin-sort-imports-es6-autofix": "^0.3.0",
"html-webpack-plugin": "^3.2.0",
"jest": "^24.1.0",
"jest-fetch-mock": "^2.0.1",
"lerna": "^3.4.0",
"pa11y-ci": "^2.1.1",
"prettier-eslint-cli": "^4.7.0"
},
"jest": {
"setupFiles": [
"./scripts/setupTests.js"
],
"collectCoverage": true,
"coverageReporters": [
"json",
"lcov"
],
"resolver": "./scripts/jest-clay-lerna-resolver",
"testPathIgnorePatterns": [
"browserslist-config-clay",
"fixtures",
"<rootDir>/examples"
],
"transformIgnorePatterns": [
"<rootDir>.*(node_modules)(?!.*clay.*).*$"
]
"prettier-eslint-cli": "^4.7.0",
"react": "^16.8.1",
"react-dom": "^16.8.1",
"react-test-renderer": "^16.6.1",
"source-map-loader": "^0.2.4",
"style-loader": "^0.23.1",
"ts-jest": "^23.10.4",
"typescript": "^3.0.3",
"webpack": "^4.29.0",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10"
},
"workspaces": {
"packages": [
"packages/*"
],
"nohoist": [
"**/clay-charts-shared"
]
},
"resolutions": {
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.declarations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false
}
}
23 changes: 23 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"noEmit": true,
"strict": true,
"jsx": "react",
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"esModuleInterop": true,
"removeComments": true,
"baseUrl": "./",
"paths": {
"@clayui/*": ["packages/*/src"],
"*": ["node_modules", "packages"]
}
},
"awesomeTypescriptLoaderOptions": {
"useBabel": true,
"babelCore": "@babel/core"
},
"include": ["packages"],
"exclude": ["node_modules", "packages/**/lib"]
}
Loading

0 comments on commit 42f87b1

Please sign in to comment.