-
Notifications
You must be signed in to change notification settings - Fork 2
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
Preset of lint used in JavaScript Projects #49
Comments
{
printWidth: 120,
// Specify the number of spaces per indentation-level.
tabWidth: 2,
// Indent lines with tabs instead of spaces.
useTabs: true,
// Only add semicolons at the beginning of lines that [may introduce ASI failures](https://prettier.io/docs/en/rationale.html#semicolons).
semi: false,
// Use single quotes instead of double quotes.
singleQuote: true,
// Trailing commas where valid in ES5 (objects, arrays, etc.). No trailing commas in type parameters in TypeScript.
trailingComma: 'es5',
// Print spaces between brackets in object literals. 👍 { foo: bar } 👎 {foo: bar}
bracketSpacing: true,
👍/**
<button
onClick={this.handleClick}
>
Click Here
</button>
*/
👎
<button
onClick={this.handleClick}>
Click Here
</button>
*/
bracketSameLine: false,
// 👍 x => x 👎 (x) => x
arrowParens: false,
endOfLine: 'lf'
}
import type {UserConfig} from '@commitlint/types';
import { RuleConfigSeverity } from "@commitlint/types";
const Configuration: UserConfig = {
/*
* Resolve and load @commitlint/config-conventional from node_modules.
* Referenced packages must be installed https://commitlint.js.org/#/reference-rules
*/
extends: ['@commitlint/config-conventional'],
/*
* Resolve and load @commitlint/format from node_modules.
* Referenced package must be installed
*/
formatter: '@commitlint/format',
/*
* Whether commitlint uses the default ignore rules.
*/
defaultIgnores: true,
/*
* Custom URL to show upon failure
*/
helpUrl: 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
};
module.exports = Configuration; |
We can establish a repository to implement packages like // .prettierrc.js
module.exports = {
...require('@magickbase/tools/prettierrc'),
// other config
} Reaching a consensus on a good solution may take a long time and involve significant differences of opinion. Therefore, we can start by incorporating the rules on which there is no disagreement into this repository and put them into practical use. This approach may facilitate the overall standardization and subsequent rule improvements.
I used to think the same way, but after referring to the explanation in https://prettier.io/docs/en/options.html#arrow-function-parentheses, I believe setting it to the default value 'always' might be better. Here's the quote:
|
IMO, |
I lean towards setting it to 'error'. Explicitly setting the return value allows for more effective type checking and makes the return value of the function easier for code readers to understand. |
My personal thought is to set external interfaces typed explicitly while leaving the internal ones inferred, it guarantees typesafe to users while keeping the flexibility of JavaScript. |
I'll collect prettier/eslint configurations from our projects here, and deduplicate them. Once the checklist is ready, we can keep those controversial rules intact and expose the unanimous in the |
There're various JavaScript projects maintained by our team, and they follow different rules due to project history, team preference, etc.
To improve consistency, we'd better define a preset rule configuration as the initial one used in all JavaScript projects.
Do you have any suggestions? @Magickbase/developers
The text was updated successfully, but these errors were encountered: