Skip to content

Commit

Permalink
chore: Improve Windows contributing experience (#908)
Browse files Browse the repository at this point in the history
* chore: Use gitattributes to enforce linebreak style instead of eslint
* docs: Fix readme generation on Windows
* docs: Visualize carriage return character in readme
  • Loading branch information
TGCrystal committed Aug 25, 2022
1 parent f8ab33a commit f775de5
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 55 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"unicorn/no-array-reduce": 0,
"unicorn/no-unsafe-regex": 0,
"unicorn/prefer-array-some": 0,
"unicorn/prevent-abbreviations": 0
"unicorn/prevent-abbreviations": 0,
"linebreak-style": 0
}
}
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Use LF line endings on all files by default.
# Allows safely disabling the "linebreak-style" linting rule.
* text eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pnpm-lock.yaml
!.editorconfig
!.eslintrc.json
!.eslintignore
!.gitattributes
!.gitignore
!.npmignore
!.README
Expand Down
104 changes: 52 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2403,14 +2403,14 @@ const fn = ( lorem, sit ) => {}
// Message: Expected JSDoc block lines to not be aligned.


/**
* Function description.
*
* @param {string} lorem Description.
* @param {int} sit Description multi words.
* @param {string} sth Multi
* line description.
*/
/**\r
* Function description.\r
*\r
* @param {string} lorem Description.\r
* @param {int} sit Description multi words.\r
* @param {string} sth Multi\r
* line description.\r
*/\r
const fn = ( lorem, sit ) => {}
// "jsdoc/check-line-alignment": ["error"|"warn", "always"]
// Message: Expected JSDoc block lines to be aligned.
Expand Down Expand Up @@ -2671,14 +2671,14 @@ const fn = ({ids}) => {}
// "jsdoc/check-line-alignment": ["error"|"warn", "always"]


/**
* Function description.
*
* @param {string} lorem Description.
* @param {int} sit Description multi words.
* @param {string} sth Multi
* line description.
*/
/**\r
* Function description.\r
*\r
* @param {string} lorem Description.\r
* @param {int} sit Description multi words.\r
* @param {string} sth Multi\r
* line description.\r
*/\r
const fn = ( lorem, sit ) => {}
// "jsdoc/check-line-alignment": ["error"|"warn", "always"]

Expand Down Expand Up @@ -6288,7 +6288,7 @@ function quux (foo) {

/**
* @module test
* @license MIT
* @license MIT\r
*/
'use strict';

Expand Down Expand Up @@ -8365,14 +8365,14 @@ function quux () {
// Message: There must be no newline after the description of the JSDoc block.


/**
* Bar.
*
* Bar.
*
* @bar
*/
function quux () {
/**\r
* Bar.\r
*\r
* Bar.\r
*\r
* @bar\r
*/\r
function quux () {\r

}
// "jsdoc/newline-after-description": ["error"|"warn", "never"]
Expand All @@ -8396,12 +8396,12 @@ function quux () {
// Message: There must be a newline after the description of the JSDoc block.


/**
* Service for fetching symbols.
* @param {object} $http - Injected http helper.
* @param {object} $q - Injected Promise api helper.
* @param {object} $location - Injected window location object.
* @param {object} REPORT_DIALOG_CONSTANTS - Injected handle.
/**\r
* Service for fetching symbols.\r
* @param {object} $http - Injected http helper.\r
* @param {object} $q - Injected Promise api helper.\r
* @param {object} $location - Injected window location object.\r
* @param {object} REPORT_DIALOG_CONSTANTS - Injected handle.\r
*/
// Message: There must be a newline after the description of the JSDoc block.

Expand Down Expand Up @@ -8464,20 +8464,20 @@ function quux () {
// "jsdoc/newline-after-description": ["error"|"warn", "never"]


/**
* @foo
* Test 
* abc 
* @bar 
/**\r
* @foo\r
* Test \r
* abc \r
* @bar \r
*/


/**
*
* @foo
* Test 
* abc 
* @bar 
/**\r
* \r
* @foo\r
* Test \r
* abc \r
* @bar \r
*/

/***
Expand All @@ -8488,16 +8488,16 @@ function quux () {
}
// "jsdoc/newline-after-description": ["error"|"warn", "always"]

/**
* Parses query string to object containing URL parameters
*
* @param queryString
* Input string
*
* @returns
* Object containing URL parameters
*/
export function parseQueryString(queryString: string): { [key: string]: string } { // <-- Line 10 that fails
/**\r
* Parses query string to object containing URL parameters\r
* \r
* @param queryString\r
* Input string\r
* \r
* @returns\r
* Object containing URL parameters\r
*/\r
export function parseQueryString(queryString: string): { [key: string]: string } { // <-- Line 10 that fails\r

}

Expand Down
4 changes: 2 additions & 2 deletions src/bin/generateReadme.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const trimCode = (code) => {
return line.slice(lineIndentSize);
});

return lines.join('\n');
return lines.join('\n').replaceAll('\r', '\\r');
};

const formatCodeSnippet = (setup, ruleName) => {
Expand All @@ -49,7 +49,7 @@ const formatCodeSnippet = (setup, ruleName) => {
};

const getAssertions = () => {
const assertionFiles = glob.sync(path.resolve(__dirname, '../../test/rules/assertions/*.js'));
const assertionFiles = glob.sync(path.resolve(__dirname, '../../test/rules/assertions/*.js').replaceAll('\\', '/'));

const assertionNames = assertionFiles.map((filePath) => {
return path.basename(filePath, '.js');
Expand Down

0 comments on commit f775de5

Please sign in to comment.