From 21eba2d473cc663c6d418b0d1e11f8d113b89fb7 Mon Sep 17 00:00:00 2001 From: Avior Date: Tue, 31 Mar 2020 11:16:04 +0200 Subject: [PATCH] Updated files Signed-off-by: Avior --- .editorconfig | 2 +- .eslintrc.js | 42 ++++++++++++++++++++++++------------------ README.md | 17 ++++++++++++++++- next.config.js | 35 ++++++++++++++++++++++------------- 4 files changed, 63 insertions(+), 33 deletions(-) diff --git a/.editorconfig b/.editorconfig index 84900a5..f8c5d3d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,4 +5,4 @@ indent_style = tab indent_size = 4 charset = utf-8 trim_trailing_whitespace = true -insert_final_newline = true \ No newline at end of file +insert_final_newline = true diff --git a/.eslintrc.js b/.eslintrc.js index 2a3b89f..3ecfdd8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -40,14 +40,16 @@ module.exports = { "error", "unix" ], - quotes: [ - "error", - "single" - ], - semi: [ - "error", - "never" - ], + + quotes: "off", + "@typescript-eslint/quotes": ["error", "single", { avoidEscape: true }], + + semi: "off", + "@typescript-eslint/semi": "error", + + "no-unused-expressions": "off", + "@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }], + "@typescript-eslint/adjacent-overload-signatures": "error", "@typescript-eslint/array-type": [ "error", @@ -109,7 +111,13 @@ module.exports = { "error", "as-needed" ], - camelcase: "error", + + camelcase: "off", + "@typescript-eslint/camelcase": ["error", { + properties: "never", + allow: ["^[A-Za-z][a-zA-Za-z]+_[A-Za-z]+$"] + }], + "comma-dangle": [ "error", "always-multiline" @@ -168,7 +176,6 @@ module.exports = { "no-undef-init": "error", "no-underscore-dangle": "error", "no-unsafe-finally": "error", - "no-unused-expressions": "error", "no-unused-labels": "error", "no-unused-vars": "off", "no-var": "error", @@ -183,14 +190,13 @@ module.exports = { "consistent-as-needed" ], "radix": "error", - "space-before-function-paren": [ - "error", - { - anonymous: "never", - asyncArrow: "always", - named: "never" - } - ], + + "space-before-function-paren": "off", + "@typescript-eslint/space-before-function-paren": ["error", { + asyncArrow: "always", + anonymous: "never", + named: "never" + }], "spaced-comment": "error", "use-isnan": "error", "valid-typeof": "off", diff --git a/README.md b/README.md index 2b985c7..3c4a14c 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ ## Folders +## __tests__ + +Test files to test webpage or single components + ### Components Folder where you put your React components @@ -33,11 +37,14 @@ Stylus files location - [x] Support Typescript - [x] Support Javascript - [ ] Support Javascript files Linting +- [x] Unit Testing +- [ ] Lint unit tests ### Stylus - [x] Support Stylus files -- [x] Support Stylus Styled-jsx +- [x] Support Stylus Styled-jsx (mutually exclusive with purgeCSS) +- [x] Support PurgeCSS (mutually exclusive with styled-jsx) - [ ] Support both Stylus CSS modules and purge CSS - [ ] Support typed stylus files @@ -62,9 +69,17 @@ Stylus files location ### Dev Dependencies +- @babel/core: Tests Dependency +- @babel/preset-env: Tests Dependency +- @babel/preset-react: Tests Dependency +- @types/jest: Testing Typing - @types/node: Typescript Typing - @types/react: Typescript Typing +- @types/react-test-renderer: Testings Typing - @typescript-eslint/eslint-plugin: ESLint Typescript Plugin - @typescript-eslint/parser: ESLint Typescript parser +- babel-jest: Compile files for jest use - eslint: ESLint - eslint-plugin-react: ESLint React Plugin +- jest: Jest tessting framework +- react-test-renderer: Test React components diff --git a/next.config.js b/next.config.js index b1cdc32..41120da 100644 --- a/next.config.js +++ b/next.config.js @@ -1,24 +1,33 @@ const stylus = require('@zeit/next-stylus') const purgeCSS = require('next-purgecss') const withPlugins = require('next-compose-plugins') +const {PHASE_DEVELOPMENT_SERVER} = require('next/constants') module.exports = withPlugins([ [stylus, { - // cssModules: true - }], - [purgeCSS, { - purgeCssPaths: [ - 'pages/**/*', - 'components/**/*', - 'styl/**/*' - ], - purgeCSS: { - content: [ - 'components/**/*.tsx', - 'pages/**/*.tsx' - ] + cssModules: true, + cssLoaderOptions: { + localIdentName: "[hash:base64:6]", + }, + [PHASE_DEVELOPMENT_SERVER]: { + cssLoaderOptions: { + localIdentName: "[path][name]__[local]" + } } }], + // [purgeCSS, { + // purgeCssPaths: [ + // 'pages/**/*', + // 'components/**/*', + // 'styl/**/*' + // ], + // purgeCSS: { + // content: [ + // 'components/**/*.tsx', + // 'pages/**/*.tsx' + // ] + // } + // }], ], { exportTrailingSlash: true, plugins: [