-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add ESLint and Prettier formatting and run initial formatting #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
.eslintrc
Outdated
| "printWidth": 80, | ||
| "tabWidth": 2, | ||
| "useTabs": false, | ||
| "trailingComma": "none", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you choose to remove the trailing comma's?
It makes cleaner diffs, which is always nicer I think?
|
Sweet, excited to get this in! I agree with @MichaelDeBoey I think we should force dangling commas for multiline though, which looks like an easy tweak to the config? EDIT: I only actually care about this if our whole config is gonna end up being custom; I'd also be fine with just following something like Standard which forbid trailing commas. |
|
Good with me! I usually leave them in too.
…On Sat, Nov 4, 2017 at 11:45 AM Adam Wathan ***@***.***> wrote:
Sweet, excited to get this in! I agree with @MichaelDeBoey
<https://github.com/michaeldeboey> I think we should force dangling
commas for multiline though, which looks like an easy tweak to the config?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#95 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADmWor0hcjBTKN-LtGywxajMt77WSCvks5szJShgaJpZM4QR5sR>
.
|
|
Can we also add the |
|
This is where we'd have to jump off the Prettier wagon. They're not interested in adding this option yet: prettier/prettier#838. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's best to include a trailing comma everywhere it's possible, so we have cleaner diffs in the future?
I'm sorry for the massive amount of comments (164, wtf! 😕) btw, but wanted to make sure you didn't forget any of them 🙂
__tests__/defineClass.test.js
Outdated
| let output = defineClass('smooth', {'-webkit-font-smoothing': 'antialiased'}) | ||
| expect(c(output.toString())).toEqual(`.smooth { -webkit-font-smoothing: antialiased }`) | ||
| let output = defineClass('smooth', { | ||
| '-webkit-font-smoothing': 'antialiased' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we can add one
__tests__/defineClasses.test.js
Outdated
| 'flex': { | ||
| display: 'flex', | ||
| flex: { | ||
| display: 'flex' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one can be re-added I guess
__tests__/defineClasses.test.js
Outdated
| 'inline-flex': { | ||
| display: 'inline-flex', | ||
| }, | ||
| display: 'inline-flex' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too
__tests__/defineClasses.test.js
Outdated
| display: 'inline-flex', | ||
| }, | ||
| display: 'inline-flex' | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too
src/build.js
Outdated
| from: `./css/${filename}.css`, | ||
| to: `./dist/${filename}.css`, | ||
| map: { inline: false }, | ||
| map: { inline: false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too
src/util/defineClass.js
Outdated
| return postcss.decl({ | ||
| prop: `${property}`, | ||
| value: `${value}`, | ||
| value: `${value}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too
src/util/defineClass.js
Outdated
| }).append(decls) | ||
| return postcss | ||
| .rule({ | ||
| selector: `.${escapeClassName(className)}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too
src/util/focusable.js
Outdated
| }).append(cloneNodes(rules)) | ||
| return postcss | ||
| .atRule({ | ||
| name: 'focusable' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too
src/util/hoverable.js
Outdated
| }).append(cloneNodes(rules)) | ||
| return postcss | ||
| .atRule({ | ||
| name: 'hoverable' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too
src/util/responsive.js
Outdated
| }).append(cloneNodes(rules)) | ||
| return postcss | ||
| .atRule({ | ||
| name: 'responsive' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too
package.json
Outdated
| "version": "0.1.3", | ||
| "description": "A utility-first CSS framework for rapidly building custom user interfaces.", | ||
| "description": | ||
| "A utility-first CSS framework for rapidly building custom user interfaces.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's best to change the printWidth to 100 or so, so this one can be on 1 line?
| throw new Error(`Specified Tailwind config file "${configFile}" doesn't exist.`) | ||
| if (!fs.existsSync(configFile)) { | ||
| throw new Error( | ||
| `Specified Tailwind config file "${configFile}" doesn't exist.` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one could also be on one line again.
| "tabWidth": 2, | ||
| "useTabs": false, | ||
| "trailingComma": "none", | ||
| "trailingComma": "es5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between this and "comma-dangle": "always-multiline"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're the same. Always add trailing commas when using multiple lines, and not when on a single line.
// Doesn't get trailing comma
let contributors: ['adam', 'jonathan', 'steve', 'david']
// Trail those commas!
let contributors: [
'adam',
'jonathan',
'steve',
'david',
]|
@MichaelDeBoey No need to point out each comma; once we get the ESLint and Prettier config set the way we want it will do all of that automatically; @davidhemphill didn't make any of these changes by hand it's just the result of Prettier running with the config that was in place at the time of running it. |
|
@adamwathan Oh I didn't know that, I'm sorry 😕 |
|
@MichaelDeBoey Haha all good! 😊 |
75f9c93 to
bab36e0
Compare
In response to #93, this PR establishes the use of ESLint using Prettier for code formatting. The ESLint config is using https://github.com/postcss/eslint-config-postcss, and Prettier is configured using the following settings: