Skip to content

Commit edeec62

Browse files
refactor: code
1 parent 797d678 commit edeec62

15 files changed

+3398
-1951
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 2018
4+
},
5+
"env": {
6+
"es6": true,
7+
"node": true,
8+
"jest": true
9+
},
10+
"extends": "eslint:recommended"
11+
}

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
node_modules
1+
.idea
2+
*.iml
3+
.nyc_output
24
coverage
3-
lib
5+
node_modules

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
language: node_js
2+
23
node_js:
3-
- "6"
4-
- "node"
4+
- "10"
5+
- "12"
6+
- "14"
7+
8+
script: yarn ci
59

610
after_success:
711
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ into:
2727

2828
- Only a certain whitelist of properties are inspected. Currently, that whitelist is `['composes']` alone.
2929
- An extend-import has the following format:
30+
3031
```
3132
composes: className [... className] from "path/to/file.css";
3233
```
@@ -37,14 +38,14 @@ composes: className [... className] from "path/to/file.css";
3738

3839
```css
3940
.aa {
40-
composes: b from './b.css';
41-
composes: c from './c.css';
41+
composes: b from "./b.css";
42+
composes: c from "./c.css";
4243
}
4344

4445
.bb {
4546
/* "b.css" should be before "c.css" in this case */
46-
composes: c from './c.css';
47-
composes: b from './b.css';
47+
composes: c from "./c.css";
48+
composes: b from "./b.css";
4849
}
4950
```
5051

@@ -57,13 +58,8 @@ npm test
5758

5859
[![Build Status](https://travis-ci.org/css-modules/postcss-modules-extract-imports.svg?branch=master)](https://travis-ci.org/css-modules/postcss-modules-extract-imports)
5960

60-
* Lines: [![Coverage Status](https://coveralls.io/repos/css-modules/postcss-modules-extract-imports/badge.svg?branch=master)](https://coveralls.io/r/css-modules/postcss-modules-extract-imports?branch=master)
61-
* Statements: [![codecov.io](http://codecov.io/github/css-modules/postcss-modules-extract-imports/coverage.svg?branch=master)](http://codecov.io/github/css-modules/postcss-modules-extract-imports?branch=master)
62-
63-
## Development
64-
65-
- `npm watch` will watch `src` for changes and rebuild
66-
- `npm autotest` will watch `src` and `test` for changes and retest
61+
- Lines: [![Coverage Status](https://coveralls.io/repos/css-modules/postcss-modules-extract-imports/badge.svg?branch=master)](https://coveralls.io/r/css-modules/postcss-modules-extract-imports?branch=master)
62+
- Statements: [![codecov.io](http://codecov.io/github/css-modules/postcss-modules-extract-imports/coverage.svg?branch=master)](http://codecov.io/github/css-modules/postcss-modules-extract-imports?branch=master)
6763

6864
## License
6965

@@ -76,4 +72,5 @@ ISC
7672
- Guy Bedford
7773

7874
---
75+
7976
Glen Maddern, 2015.

husky.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
hooks: {
3+
"pre-commit": "lint-staged",
4+
},
5+
};

lint-staged.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
"*.js": ["prettier --write", "eslint --fix"],
3+
"*.{json,md,yml,css,ts}": ["prettier --write"],
4+
};

package.json

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
"description": "A CSS Modules transform to extract local aliases for inline imports",
55
"main": "src/index.js",
66
"engines": {
7-
"node": ">= 6"
7+
"node": ">= 10.13.0 || >= 12.13.0 || >= 14"
88
},
99
"files": [
1010
"src"
1111
],
1212
"scripts": {
13+
"prettier": "prettier -l --ignore-path .gitignore . \"!test/test-cases\"",
14+
"eslint": "eslint --ignore-path .gitignore .",
15+
"lint": "yarn eslint && yarn prettier",
16+
"pretest": "yarn lint",
1317
"test": "jest --coverage",
14-
"precommit": "lint-staged",
15-
"prepublish": "yarn run test"
16-
},
17-
"lint-staged": {
18-
"*.js": [
19-
"prettier --single-quote --no-semi --write",
20-
"git add"
21-
]
18+
"autotest": "chokidar src/index.js test/test.js -c 'yarn test'",
19+
"cover": "istanbul cover test/index.js",
20+
"ci": "yarn pretest && yarn cover",
21+
"prepublishOnly": "yarn test"
2222
},
2323
"repository": {
2424
"type": "git",
@@ -35,15 +35,16 @@
3535
"url": "https://github.com/css-modules/postcss-modules-extract-imports/issues"
3636
},
3737
"homepage": "https://github.com/css-modules/postcss-modules-extract-imports",
38-
"dependencies": {
39-
"postcss": "^7.0.5"
40-
},
4138
"devDependencies": {
42-
"codecov.io": "^0.1.2",
43-
"coveralls": "^2.11.2",
44-
"husky": "^0.13.3",
45-
"jest": "^20.0.3",
46-
"lint-staged": "^3.4.2",
47-
"prettier": "^1.3.1"
39+
"codecov.io": "^0.1.6",
40+
"coveralls": "^3.1.0",
41+
"husky": "^4.3.0",
42+
"jest": "^26.4.2",
43+
"lint-staged": "^10.4.0",
44+
"postcss": "^8.0.6",
45+
"prettier": "^2.1.2"
46+
},
47+
"peerDependencies": {
48+
"postcss": "^8.0.6"
4849
}
4950
}

0 commit comments

Comments
 (0)