Skip to content

Commit

Permalink
feat(prettier-config-bananass): introduce prettier-config-bananass
Browse files Browse the repository at this point in the history
…package (#57)

This pull request includes the creation and integration of a new
Prettier configuration package named `prettier-config-bananass`. The
main changes involve updating configuration files, adding dependencies,
and creating the new package with its associated files and tests.

### Integration of `prettier-config-bananass`:

*
[`.prettierrc.js`](diffhunk://#diff-7312296367dd7c725b9beb500d7dab7bbeeb2aa03a1010a3fb2935f826d03fa6L1-R1):
Changed to use the new `prettier-config-bananass` package.
*
[`package.json`](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R3-R4):
Added `prettier-config-bananass` as a dependency and updated metadata.
[[1]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R3-R4)
[[2]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R45)

### Creation of `prettier-config-bananass` package:

*
[`packages/prettier-config-bananass/package.json`](diffhunk://#diff-0fdaf27a6fc3a9c98ce068e2f60dd6fa1d2a82cfc232695581bcae3256c32d76R1-R39):
Added metadata, scripts, and configuration for the new package.
*
[`packages/prettier-config-bananass/src/index.js`](diffhunk://#diff-5704c175b00dfba9748074a44221d8bdeafc9a341ed6c6107bb94b85ee8394f5R1-R28):
Defined the Prettier configuration settings.
*
[`packages/prettier-config-bananass/src/index.test.js`](diffhunk://#diff-b8873c5676cad2e44ca6ba4d5d8613a21d19ab0a1bb66f3548dfb45b20fdb8f7R1-R78):
Added tests to ensure the configuration settings are correct.
  • Loading branch information
lumirlumir authored Jan 8, 2025
1 parent 4c92a0b commit 8026550
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 11 deletions.
12 changes: 1 addition & 11 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
module.exports = {
printWidth: 90,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: true,
arrowParens: 'avoid',
proseWrap: 'never',
};
module.exports = require('prettier-config-bananass');
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"private": true,
"name": "npm-bananass",
"version": "0.0.0",
"packageManager": "npm@10.9.2",
"workspaces": [
"examples/*",
Expand Down Expand Up @@ -40,6 +42,7 @@
"lint-staged": "^15.2.10",
"markdownlint-cli": "^0.43.0",
"prettier": "^3.4.1",
"prettier-config-bananass": "^0.0.0",
"textlint": "^14.3.0",
"textlint-rule-allowed-uris": "^1.0.6",
"typescript": "^5.7.2"
Expand Down
39 changes: 39 additions & 0 deletions packages/prettier-config-bananass/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "prettier-config-bananass",
"version": "0.0.0",
"description": "Prettier Config for Bananass Framework.🍌",
"exports": "./src/index.js",
"files": [
"src/index.js",
"LICENSE.md",
"README.md"
],
"keywords": [
"bananass",
"baekjoon",
"framework",
"javascript",
"prettier",
"prettierconfig",
"prettier-config",
"config"
],
"author": "루밀LuMir <rpfos@naver.com> (https://github.com/lumirlumir)",
"license": "MIT",
"homepage": "https://github.com/lumirlumir/npm-bananass",
"repository": {
"type": "github",
"url": "git+https://github.com/lumirlumir/npm-bananass.git",
"directory": "packages/prettier-config-bananass"
},
"bugs": {
"url": "https://github.com/lumirlumir/npm-bananass/issues"
},
"engines": {
"node": ">=20.18.0"
},
"scripts": {
"build": "cp ../../LICENSE.md ../../README.md .",
"test": "node --test"
}
}
28 changes: 28 additions & 0 deletions packages/prettier-config-bananass/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @fileoverview Entry file for the `prettier-config-bananass` package.
* @module prettier-config-bananass
*
* All default values are based on `prettier@3`.
*/

// --------------------------------------------------------------------------------
// Exports
// --------------------------------------------------------------------------------

module.exports = {
printWidth: 90,
tabWidth: 2, // Default.
useTabs: false, // Default.
semi: true, // Default.
singleQuote: true,
quoteProps: 'as-needed', // Default.
jsxSingleQuote: false, // Default.
trailingComma: 'all', // Default.
bracketSpacing: true, // Default.
bracketSameLine: false, // Default.
arrowParens: 'avoid',
proseWrap: 'never',
htmlWhitespaceSensitivity: 'css', // Default.
endOfLine: 'lf', // Default.
singleAttributePerLine: false, // Default.
};
78 changes: 78 additions & 0 deletions packages/prettier-config-bananass/src/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/**
* @fileoverview Test for `index.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { strictEqual } = require('node:assert');
const { describe, it } = require('node:test');

const prettierConfig = require('./index');

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('index.js', () => {
it('printWidth should be 90', () => {
strictEqual(prettierConfig.printWidth, 90);
});

it('tabWidth should be 2', () => {
strictEqual(prettierConfig.tabWidth, 2);
});

it('useTabs should be false', () => {
strictEqual(prettierConfig.useTabs, false);
});

it('semi should be true', () => {
strictEqual(prettierConfig.semi, true);
});

it('singleQuote should be true', () => {
strictEqual(prettierConfig.singleQuote, true);
});

it('quoteProps should be "as-needed"', () => {
strictEqual(prettierConfig.quoteProps, 'as-needed');
});

it('jsxSingleQuote should be false', () => {
strictEqual(prettierConfig.jsxSingleQuote, false);
});

it('trailingComma should be "all"', () => {
strictEqual(prettierConfig.trailingComma, 'all');
});

it('bracketSpacing should be true', () => {
strictEqual(prettierConfig.bracketSpacing, true);
});

it('bracketSameLine should be false', () => {
strictEqual(prettierConfig.bracketSameLine, false);
});

it('arrowParens should be "avoid"', () => {
strictEqual(prettierConfig.arrowParens, 'avoid');
});

it('proseWrap should be "never"', () => {
strictEqual(prettierConfig.proseWrap, 'never');
});

it('htmlWhitespaceSensitivity should be "css"', () => {
strictEqual(prettierConfig.htmlWhitespaceSensitivity, 'css');
});

it('endOfLine should be "lf"', () => {
strictEqual(prettierConfig.endOfLine, 'lf');
});

it('singleAttributePerLine should be false', () => {
strictEqual(prettierConfig.singleAttributePerLine, false);
});
});

0 comments on commit 8026550

Please sign in to comment.