Skip to content

Commit

Permalink
Merge pull request #667 from ben-rogerson/feature/better-suggestions
Browse files Browse the repository at this point in the history
Better suggestions
  • Loading branch information
ben-rogerson committed Apr 22, 2022
2 parents a39a3cc + 7a0c7f0 commit 846b1f2
Show file tree
Hide file tree
Showing 128 changed files with 20,655 additions and 36,337 deletions.
59 changes: 25 additions & 34 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
module.exports = {
settings: {
version: 'detect',
},
settings: { version: 'detect' },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:unicorn/recommended',
'xo/browser',
'xo/esnext',
'xo-typescript/space',
'xo-react/space',
'plugin:chai-friendly/recommended',
'plugin:jest/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'prettier/@typescript-eslint',
'prettier',
'prettier/babel',
'prettier/react',
'prettier/unicorn',
],
plugins: ['chai-friendly', 'jest', 'import'],
rules: {
Expand All @@ -35,47 +28,42 @@ module.exports = {
'@typescript-eslint/no-base-to-string': 0,
'@typescript-eslint/prefer-nullish-coalescing': 0,
'@typescript-eslint/no-unsafe-return': 0,
'@typescript-eslint/no-confusing-void-expression': 0,
'@typescript-eslint/no-unsafe-assignment': 0,
'@typescript-eslint/semi': 0,
'@typescript-eslint/restrict-template-expressions': 0,
'@typescript-eslint/default-param-last': 0,
'@typescript-eslint/prefer-optional-chain': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/naming-convention': 0,
'@typescript-eslint/no-require-imports': 0,
'@typescript-eslint/no-throw-literal': 0,
'@typescript-eslint/no-implicit-any-catch': 0,
'@typescript-eslint/triple-slash-reference': 0,
'react/prop-types': 0,
'jest/prefer-expect-assertions': 0,
'capitalized-comments': 0,
'comma-dangle': 0,
'import/extensions': [
'error',
{
svg: 'allow',
},
],
'import/no-unassigned-import': [
'error',
{
allow: ['**/*.css'],
},
],
'unicorn/filename-case': [
'error',
{
case: 'camelCase',
},
],
'import/extensions': ['error', { svg: 'allow' }],
'import/no-unassigned-import': ['error', { allow: ['**/*.css'] }],
'unicorn/filename-case': ['error', { case: 'camelCase' }],
'unicorn/prefer-type-error': 0,
'unicorn/no-reduce': 0,
'unicorn/import-style': 0,
'unicorn/prefer-optional-catch-binding': 0,
'unicorn/no-null': 0,
'unicorn/prevent-abbreviations': 0,
'unicorn/no-array-reduce': 0,
'unicorn/prefer-module': 0,
'unicorn/consistent-destructuring': 0,
'unicorn/prefer-node-protocol': 0,
'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
},
overrides: [
{
files: ['**/*.ts', '**/*.js'],
rules: {
'jest/no-try-expect': 0,
},
rules: { 'jest/no-try-expect': 0 },
},
{
files: ['**/*.js', '**/*.jsx'],
Expand All @@ -96,9 +84,12 @@ module.exports = {
},
},
],
ignorePatterns: ['.eslintrc.js'],
globals: {
JSX: true,
AriaAttributes: true,
},
ignorePatterns: [
'.eslintrc.js',
'macro.js',
'types',
'__fixtures__',
'tailwind.config.js',
],
globals: { JSX: true, AriaAttributes: true },
}
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"singleQuote": true,
"bracketSpacing": true,
"tabWidth": 2,
"jsxBracketSameLine": false,
"trailingComma": "es5",
"useTabs": false,
"arrowParens": "avoid"
Expand Down
26 changes: 13 additions & 13 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ tw`text-sm md:text-lg`
**👌 Simple imports** - Twin collapses imports from common styling libraries into a single import:

```diff
+ import tw, { styled, css } from 'twin.macro'
- import tw from 'twin.macro'
- import styled from '@emotion/styled'
- import css from '@emotion/react'
- import tw from 'twin.macro'
+ import tw, { styled, css } from 'twin.macro'
```

**🐹 Adds no size to your build** - Twin converts the classes you’ve used into css objects using Babel and then compiles away, leaving no runtime code
Expand Down Expand Up @@ -203,7 +203,6 @@ Twin works within many modern stacks - take a look at these examples to get star
- **Webpack**<br/>[styled-components (ts)](https://github.com/ben-rogerson/twin.examples/tree/master/webpack-styled-components-typescript) / [emotion (ts)](https://github.com/ben-rogerson/twin.examples/tree/master/webpack-emotion-typescript)
- **Preact**<br/>[styled-components](https://github.com/ben-rogerson/twin.examples/tree/master/preact-styled-components) / [emotion](https://github.com/ben-rogerson/twin.examples/tree/master/preact-emotion) / [goober](https://github.com/ben-rogerson/twin.examples/tree/master/preact-goober)
- **Create React App**<br/>[styled-components](https://github.com/ben-rogerson/twin.examples/tree/master/cra-styled-components) / [emotion](https://github.com/ben-rogerson/twin.examples/tree/master/cra-emotion)
- **Snowpack**<br/>[styled-components](https://github.com/ben-rogerson/twin.examples/tree/master/snowpack-react-styled-components) / [styled-components (ts)](https://github.com/ben-rogerson/twin.examples/tree/master/snowpack-react-styled-components-typescript) / [emotion](https://github.com/ben-rogerson/twin.examples/tree/master/snowpack-react-emotion) / [emotion (ts)](https://github.com/ben-rogerson/twin.examples/tree/master/snowpack-react-emotion-typescript)
- **Vite**<br/>[styled-components (ts)](https://github.com/ben-rogerson/twin.examples/tree/master/vite-styled-components-typescript) / [emotion (ts)](https://github.com/ben-rogerson/twin.examples/tree/master/vite-emotion-typescript)

### Advanced frameworks
Expand Down
2 changes: 0 additions & 2 deletions __fixtures__/!custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ tw`group-hocus:bg-red-500`
tw`group-focus:bg-red-500`
tw`group-active:bg-red-500`
tw`group-visited:bg-red-500`

tw`stroke-non-scaling`
20 changes: 11 additions & 9 deletions __fixtures__/colorFunctions/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
const color = name => ({ opacityVariable, opacityValue }) => {
if (opacityValue !== undefined) {
return `rgba(var(--twc-${name}), ${opacityValue})`
}
const color =
name =>
({ opacityVariable, opacityValue }) => {
if (opacityValue !== undefined) {
return `rgba(var(--twc-${name}), ${opacityValue})`
}

if (opacityVariable !== undefined) {
return `rgba(var(--twc-${name}), var(${opacityVariable}, 1))`
}
if (opacityVariable !== undefined) {
return `rgba(var(--twc-${name}), var(${opacityVariable}, 1))`
}

return `rgb(var(--twc-${name}))`
}
return `rgb(var(--twc-${name}))`
}

const colorScale = name =>
[50, 100, 200, 300, 400, 500, 600, 700, 800, 900].reduce(
Expand Down
1 change: 0 additions & 1 deletion __fixtures__/cssPropEmotion/autoCssProp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import './macro' // twinImport

;<div css="" />
;<div className="" />
1 change: 0 additions & 1 deletion __fixtures__/cssPropStyledComponents/autoCssProp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import './macro' // twinImport

;<div css="" />
;<div className="" />
3 changes: 3 additions & 0 deletions __fixtures__/utilitiesBorders/borderColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1625,3 +1625,6 @@ tw`border-l-[color:rgba(255, 255, 255, .45)]`

tw`border-[color:green]`
tw`border-[color:rgba(255, 255, 255, .45)]`

tw`border-x-[color:green]`
tw`border-y-[color:rgba(255, 255, 255, .45)]`
3 changes: 3 additions & 0 deletions __fixtures__/utilitiesBorders/borderWidth.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ tw`border-t-[length:10px]`
tw`border-r-[length:10px]`
tw`border-b-[length:10px]`
tw`border-l-[length:10px]`
tw`border-l-[length:10px]`
tw`border-x-[length:10px]`
tw`border-y-[length:10px]`
tw`border-[length:10px]`
Loading

0 comments on commit 846b1f2

Please sign in to comment.