Skip to content

Commit b6a084e

Browse files
authored
Merge pull request #167 from srmagura/change-prettier-settings
Change Prettier settings to be more standard
2 parents 072d507 + 320910d commit b6a084e

33 files changed

+1225
-1182
lines changed

.config/jest.config.cjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
const path = require('path')
1+
const path = require('path');
22

33
module.exports = {
4-
testEnvironment: 'jsdom',
4+
testEnvironment: 'jsdom',
55

6-
rootDir: path.resolve(__dirname, '..'),
7-
testMatch: ['**/__tests__/**/*.test.ts?(x)'],
6+
rootDir: path.resolve(__dirname, '..'),
7+
testMatch: ['**/__tests__/**/*.test.ts?(x)'],
88

9-
transform: {
10-
'^.+\\.(t|j)sx?$': ['@swc/jest'],
11-
},
12-
}
9+
transform: {
10+
'^.+\\.(t|j)sx?$': ['@swc/jest'],
11+
},
12+
};

.config/rollup.config.mjs

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
1-
import typescript from '@rollup/plugin-typescript'
2-
import copy from 'rollup-plugin-copy'
1+
import typescript from '@rollup/plugin-typescript';
2+
import copy from 'rollup-plugin-copy';
33

44
export default {
5-
input: 'src/index.ts',
6-
external: ['react'],
7-
output: [
8-
{
9-
file: 'dist/index.mjs',
10-
format: 'es',
5+
input: 'src/index.ts',
6+
external: ['react'],
7+
output: [
8+
{
9+
file: 'dist/index.mjs',
10+
format: 'es',
1111

12-
// This disables the warning "Mixing named and default exports"
13-
exports: 'named',
12+
// This disables the warning "Mixing named and default exports"
13+
exports: 'named',
1414

15-
/**
16-
* This is required to prevent the error:
17-
*
18-
* Can't import the named export 'useContext' from non EcmaScript
19-
* module (only default export is available)
20-
*
21-
* This error occurred in a Webpack 4 app (Create React App). We can
22-
* hopefully remove the `interop` key if React decides to publish an
23-
* ES module and/or Webpack 4 usage declines.
24-
*
25-
* -----
26-
*
27-
* Here is the Rollup documentation on `defaultOnly`:
28-
*
29-
* Named imports are forbidden. If such an import is encountered,
30-
* Rollup throws an error even in es and system formats. That way it
31-
* is ensures that the es version of the code is able to import
32-
* non-builtin CommonJS modules in Node correctly.
33-
*/
34-
interop: 'defaultOnly',
35-
/**
36-
* This is required to prevent the error:
37-
*
38-
* TypeError: createContext only works in Client Components.
39-
* Add the "use client" directive at the top of the file to use it.
40-
*
41-
* -----
42-
*
43-
* Here is the Rollup documentation on `banner`:
44-
* A string to prepend/append to the bundle. You can also
45-
* supply a function that returns a Promise that resolves
46-
* to a string to generate it asynchronously
47-
*
48-
* (Note: banner and footer options will not
49-
* break sourcemaps).
50-
*/
51-
banner: "'use client';",
52-
},
53-
{
54-
dir: 'dist',
55-
format: 'cjs',
56-
exports: 'named',
57-
banner: "'use client';",
58-
},
59-
],
60-
plugins: [
61-
typescript({ exclude: ['**/__tests__/**/*', '**/__stories__/**/*'] }),
62-
copy({
63-
targets: [{ src: 'src/skeleton.css', dest: 'dist' }],
64-
}),
65-
],
66-
}
15+
/**
16+
* This is required to prevent the error:
17+
*
18+
* Can't import the named export 'useContext' from non EcmaScript
19+
* module (only default export is available)
20+
*
21+
* This error occurred in a Webpack 4 app (Create React App). We can
22+
* hopefully remove the `interop` key if React decides to publish an
23+
* ES module and/or Webpack 4 usage declines.
24+
*
25+
* -----
26+
*
27+
* Here is the Rollup documentation on `defaultOnly`:
28+
*
29+
* Named imports are forbidden. If such an import is encountered,
30+
* Rollup throws an error even in es and system formats. That way it
31+
* is ensures that the es version of the code is able to import
32+
* non-builtin CommonJS modules in Node correctly.
33+
*/
34+
interop: 'defaultOnly',
35+
/**
36+
* This is required to prevent the error:
37+
*
38+
* TypeError: createContext only works in Client Components.
39+
* Add the "use client" directive at the top of the file to use it.
40+
*
41+
* -----
42+
*
43+
* Here is the Rollup documentation on `banner`:
44+
* A string to prepend/append to the bundle. You can also
45+
* supply a function that returns a Promise that resolves
46+
* to a string to generate it asynchronously
47+
*
48+
* (Note: banner and footer options will not
49+
* break sourcemaps).
50+
*/
51+
banner: "'use client';",
52+
},
53+
{
54+
dir: 'dist',
55+
format: 'cjs',
56+
exports: 'named',
57+
banner: "'use client';",
58+
},
59+
],
60+
plugins: [
61+
typescript({ exclude: ['**/__tests__/**/*', '**/__stories__/**/*'] }),
62+
copy({
63+
targets: [{ src: 'src/skeleton.css', dest: 'dist' }],
64+
}),
65+
],
66+
};

.editorconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ root = true
33
[*]
44
charset = utf-8
55
indent_style = space
6-
indent_size = 4
6+
indent_size = 2
77
end_of_line = lf
88
insert_final_newline = true
99
trim_trailing_whitespace = true
10-
11-
[*.yml]
12-
indent_size = 2

.eslintrc.cjs

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
module.exports = {
2-
parserOptions: {
3-
project: './tsconfig.json',
4-
},
5-
extends: [
6-
'airbnb',
7-
'airbnb-typescript',
8-
'airbnb/hooks',
9-
'plugin:jest/recommended',
10-
'plugin:jest-dom/recommended',
11-
'plugin:testing-library/react',
12-
'plugin:@typescript-eslint/recommended',
13-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
14-
'prettier',
2+
parserOptions: {
3+
project: './tsconfig.json',
4+
},
5+
extends: [
6+
'airbnb',
7+
'airbnb-typescript',
8+
'airbnb/hooks',
9+
'plugin:jest/recommended',
10+
'plugin:jest-dom/recommended',
11+
'plugin:testing-library/react',
12+
'plugin:@typescript-eslint/recommended',
13+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
14+
'prettier',
15+
],
16+
plugins: ['@typescript-eslint', 'jest', 'jest-dom', 'testing-library'],
17+
ignorePatterns: ['*.js', '*.cjs', 'dist/'],
18+
settings: {
19+
'testing-library/custom-renders': 'off',
20+
},
21+
rules: {
22+
'no-plusplus': 'off',
23+
'no-restricted-syntax': [
24+
'error',
25+
// Options from https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
26+
// with for-of removed
27+
{
28+
selector: 'ForInStatement',
29+
message:
30+
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
31+
},
32+
{
33+
selector: 'LabeledStatement',
34+
message:
35+
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
36+
},
37+
{
38+
selector: 'WithStatement',
39+
message:
40+
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
41+
},
1542
],
16-
plugins: ['@typescript-eslint', 'jest', 'jest-dom', 'testing-library'],
17-
ignorePatterns: ['*.js', '*.cjs', 'dist/'],
18-
settings: {
19-
'testing-library/custom-renders': 'off',
20-
},
21-
rules: {
22-
'no-plusplus': 'off',
23-
'no-restricted-syntax': [
24-
'error',
25-
// Options from https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
26-
// with for-of removed
27-
{
28-
selector: 'ForInStatement',
29-
message:
30-
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
31-
},
32-
{
33-
selector: 'LabeledStatement',
34-
message:
35-
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
36-
},
37-
{
38-
selector: 'WithStatement',
39-
message:
40-
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
41-
},
42-
],
4343

44-
'import/no-extraneous-dependencies': [
45-
'error',
46-
{
47-
devDependencies: ['src/__stories__/**/*', 'src/__tests__/**/*'],
48-
},
49-
],
50-
'import/prefer-default-export': 'off',
44+
'import/no-extraneous-dependencies': [
45+
'error',
46+
{
47+
devDependencies: ['src/__stories__/**/*', 'src/__tests__/**/*'],
48+
},
49+
],
50+
'import/prefer-default-export': 'off',
5151

52-
'react/require-default-props': 'off',
53-
'react/function-component-definition': 'off',
52+
'react/require-default-props': 'off',
53+
'react/function-component-definition': 'off',
5454

55-
'testing-library/no-node-access': 'off',
56-
},
57-
}
55+
'testing-library/no-node-access': 'off',
56+
},
57+
};

.github/CODE_OF_CONDUCT.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ diverse, inclusive, and healthy community.
1717
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

20-
- Demonstrating empathy and kindness toward other people
21-
- Being respectful of differing opinions, viewpoints, and experiences
22-
- Giving and gracefully accepting constructive feedback
23-
- Accepting responsibility and apologizing to those affected by our mistakes,
24-
and learning from the experience
25-
- Focusing on what is best not just for us as individuals, but for the
26-
overall community
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the
26+
overall community
2727

2828
Examples of unacceptable behavior include:
2929

30-
- The use of sexualized language or imagery, and sexual attention or
31-
advances of any kind
32-
- Trolling, insulting or derogatory comments, and personal or political attacks
33-
- Public or private harassment
34-
- Publishing others' private information, such as a physical or email
35-
address, without their explicit permission
36-
- Other conduct which could reasonably be considered inappropriate in a
37-
professional setting
30+
- The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
3838

3939
## Enforcement Responsibilities
4040

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ A clear and concise description of what you expected to happen.
2020

2121
**Versions**
2222

23-
- react-loading-skeleton version:
24-
- Browser version:
23+
- react-loading-skeleton version:
24+
- Browser version:
2525

2626
**Additional context**
2727
Add any other context about the problem here.

.prettierrc.cjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
module.exports = {
2-
semi: false,
3-
singleQuote: true,
4-
printWidth: 90,
5-
}
2+
singleQuote: true,
3+
};

.storybook/main.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
2-
stories: ['../**/*.stories.mdx', '../**/*.stories.@(js|jsx|ts|tsx)'],
3-
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
4-
core: {
5-
builder: 'webpack5',
6-
},
7-
}
2+
stories: ['../**/*.stories.mdx', '../**/*.stories.@(js|jsx|ts|tsx)'],
3+
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
4+
core: {
5+
builder: 'webpack5',
6+
},
7+
};

.storybook/preview.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import './storybook.css'
2-
import '../src/skeleton.css'
1+
import './storybook.css';
2+
import '../src/skeleton.css';
33

44
export const parameters = {
5-
options: {
6-
storySort: {
7-
order: ['Skeleton', 'SkeletonTheme', 'Post'],
8-
},
5+
options: {
6+
storySort: {
7+
order: ['Skeleton', 'SkeletonTheme', 'Post'],
98
},
10-
actions: { argTypesRegex: '^on[A-Z].*' },
11-
controls: {
12-
matchers: {
13-
color: /(background|color)$/i,
14-
date: /Date$/,
15-
},
9+
},
10+
actions: { argTypesRegex: '^on[A-Z].*' },
11+
controls: {
12+
matchers: {
13+
color: /(background|color)$/i,
14+
date: /Date$/,
1615
},
17-
}
16+
},
17+
};

.storybook/storybook.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
body {
2-
font-family: sans-serif;
2+
font-family: sans-serif;
33
}

0 commit comments

Comments
 (0)