Skip to content

Commit bf0ea90

Browse files
refactor: code
1 parent ec1cb48 commit bf0ea90

File tree

10 files changed

+1374
-1972
lines changed

10 files changed

+1374
-1972
lines changed

.eslintrc

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
"ecmaVersion": 2018
44
},
55
"env": {
6+
"es6": true,
67
"node": true
78
},
8-
"rules": {
9-
"quotes": [2, "single", { "avoidEscape": true }]
10-
}
9+
"extends": "eslint:recommended"
1110
}

.gitignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
node_modules/
2-
npm-debug.log
1+
.idea
2+
*.iml
3+
.nyc_output
34
coverage
5+
node_modules
6+

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
language: node_js
2+
23
node_js:
3-
- "6"
4-
- "8"
54
- "10"
65
- "12"
76
- "14"
8-
script: npm run travis
7+
8+
script: yarn ci
99

1010
after_success:
1111
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose

CHANGELOG.md

+64-14
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,168 @@
11
# Change Log
2+
23
All notable changes to this project will be documented in this file.
34
This project adheres to [Semantic Versioning](http://semver.org/).
45

56
## [3.0.3] - 2020-07-25
7+
68
### Fixed
9+
710
- treat `:import` and `:export` statements as pure
811

912
## [3.0.2] - 2019-06-05
13+
1014
### Fixed
15+
1116
- better handle invalid syntax
1217

1318
## [3.0.1] - 2019-05-16
19+
1420
### Fixed
21+
1522
- adds safety check before accessing "rule parent"
1623

1724
## [3.0.0] - 2019-05-07
25+
1826
### Features
19-
- don't localize imported values in selectors
27+
28+
- don't localize imported values in selectors
29+
2030
### Changes
21-
- don't localize imported values in selectors
31+
32+
- don't localize imported values in selectors
2233

2334
## [2.0.6] - 2019-03-05
35+
2436
### Fixed
37+
2538
- handles properly selector with escaping characters (like: `.\31 a2b3c { color: red }`)
2639

2740
## [2.0.5] - 2019-02-06
41+
2842
### Fixed
43+
2944
- Path to `index.js`
3045

3146
## [2.0.4] - 2019-01-04
47+
3248
### Fixed
49+
3350
- Inappropriate modification of `steps` function arguments
3451

3552
## [2.0.3] - 2018-12-21
53+
3654
### Fixed
55+
3756
- Don't modify inappropriate animation keywords
3857

3958
## [2.0.2] - 2018-12-05
59+
4060
### Fixed
61+
4162
- Don't break unicode characters.
4263

4364
## [2.0.1] - 2018-11-23
65+
4466
### Fixed
67+
4568
- Handle uppercase `keyframes` at rule.
4669

4770
## [2.0.0] - 2018-11-23
71+
4872
### Changed
73+
4974
- Drop support `nodejs@4`.
5075
- Update `postcss` version to `7`.
5176

5277
## [0.0.11] - 2015-07-19
78+
5379
### Fixed
80+
5481
- Localisation of animation properties.
5582

5683
## [0.0.10] - 2015-06-17
84+
5785
### Added
86+
5887
- Localised at-rules.
5988

6089
## [0.0.9] - 2015-06-12
90+
6191
### Changed
92+
6293
- Using global selectors outside of a global context no longer triggers warnings. Instead, this functionality will be provided by a CSS Modules linter.
6394

6495
### Fixed
96+
6597
- Keyframe rules.
6698

6799
## [0.0.8] - 2015-06-11
100+
68101
### Added
102+
69103
- Pure mode where only local scope is allowed.
70104

71105
### Changed
106+
72107
- Using global selectors outside of a global context now triggers warnings.
73108

74109
## [0.0.7] - 2015-05-30
110+
75111
### Changed
112+
76113
- Migrated to `css-selector-tokenizer`.
77114

78115
## [0.0.6] - 2015-05-28
116+
79117
### Changed
118+
80119
- Renamed project to `postcss-modules-local-by-default`.
81120

82121
## [0.0.5] - 2015-05-22
122+
83123
### Added
124+
84125
- Support for css-loader [inheritance](https://github.com/webpack/css-loader#inheriting) and [local imports](https://github.com/webpack/css-loader#importing-local-class-names).
85126

86127
## [0.0.4] - 2015-05-22
128+
87129
### Changed
130+
88131
- Hide global leak detection behind undocumented `lint` option until it's more robust.
89132

90133
## [0.0.3] - 2015-05-22
134+
91135
### Changed
136+
92137
- Transformer output now uses the new `:local(.identifier)` syntax.
93138

94139
### Added
140+
95141
- Simple global leak detection. Non-local selectors like `input{}` and `[data-foobar]` now throw when not marked as global.
96142

97143
## [0.0.2] - 2015-05-14
144+
98145
### Added
146+
99147
- Support for global selectors appended directly to locals, e.g. `.foo:global(.bar)`
100148

101149
## 0.0.1 - 2015-05-12
150+
102151
### Added
152+
103153
- Automatic local classes
104154
- Explicit global selectors with `:global`
105155

106156
[unreleased]: https://github.com/postcss-modules-local-by-default/compare/v0.0.10...HEAD
107-
[0.0.2]: https://github.com/postcss-modules-local-by-default/compare/v0.0.1...v0.0.2
108-
[0.0.3]: https://github.com/postcss-modules-local-by-default/compare/v0.0.2...v0.0.3
109-
[0.0.4]: https://github.com/postcss-modules-local-by-default/compare/v0.0.3...v0.0.4
110-
[0.0.5]: https://github.com/postcss-modules-local-by-default/compare/v0.0.4...v0.0.5
111-
[0.0.6]: https://github.com/postcss-modules-local-by-default/compare/v0.0.5...v0.0.6
112-
[0.0.7]: https://github.com/postcss-modules-local-by-default/compare/v0.0.6...v0.0.7
113-
[0.0.8]: https://github.com/postcss-modules-local-by-default/compare/v0.0.7...v0.0.8
114-
[0.0.9]: https://github.com/postcss-modules-local-by-default/compare/v0.0.8...v0.0.9
115-
[0.0.10]: https://github.com/postcss-modules-local-by-default/compare/v0.0.9...v0.0.10
116-
[0.0.11]: https://github.com/postcss-modules-local-by-default/compare/v0.0.10...v0.0.11
117-
[2.0.0]: https://github.com/postcss-modules-local-by-default/compare/v1.3.1...v2.0.0
118-
[2.0.1]: https://github.com/postcss-modules-local-by-default/compare/v2.0.0...v2.0.1
157+
[0.0.2]: https://github.com/postcss-modules-local-by-default/compare/v0.0.1...v0.0.2
158+
[0.0.3]: https://github.com/postcss-modules-local-by-default/compare/v0.0.2...v0.0.3
159+
[0.0.4]: https://github.com/postcss-modules-local-by-default/compare/v0.0.3...v0.0.4
160+
[0.0.5]: https://github.com/postcss-modules-local-by-default/compare/v0.0.4...v0.0.5
161+
[0.0.6]: https://github.com/postcss-modules-local-by-default/compare/v0.0.5...v0.0.6
162+
[0.0.7]: https://github.com/postcss-modules-local-by-default/compare/v0.0.6...v0.0.7
163+
[0.0.8]: https://github.com/postcss-modules-local-by-default/compare/v0.0.7...v0.0.8
164+
[0.0.9]: https://github.com/postcss-modules-local-by-default/compare/v0.0.8...v0.0.9
165+
[0.0.10]: https://github.com/postcss-modules-local-by-default/compare/v0.0.9...v0.0.10
166+
[0.0.11]: https://github.com/postcss-modules-local-by-default/compare/v0.0.10...v0.0.11
167+
[2.0.0]: https://github.com/postcss-modules-local-by-default/compare/v1.3.1...v2.0.0
168+
[2.0.1]: https://github.com/postcss-modules-local-by-default/compare/v2.0.0...v2.0.1

README.md

+15-12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
Transformation examples:
66

7+
<!-- prettier-ignore-start -->
78
```css
89
.foo { ... } /* => */ :local(.foo) { ... }
910

@@ -25,6 +26,7 @@ Transformation examples:
2526

2627
.foo:global(.bar) .baz { ... } /* => */ :local(.foo).bar :local(.baz) { ... }
2728
```
29+
<!-- prettier-ignore-end -->
2830

2931
## Building
3032

@@ -33,9 +35,9 @@ $ npm install
3335
$ npm test
3436
```
3537

36-
- Build: [![Build Status][ci-img]][ci]
37-
- Lines: [![coveralls][coveralls-img]][coveralls]
38-
- Statements: [![codecov][codecov-img]][codecov]
38+
- Build: [![Build Status][ci-img]][ci]
39+
- Lines: [![coveralls][coveralls-img]][coveralls]
40+
- Statements: [![codecov][codecov-img]][codecov]
3941

4042
## Development
4143

@@ -49,17 +51,18 @@ MIT
4951

5052
## With thanks
5153

52-
- [Tobias Koppers](https://github.com/sokra)
53-
- [Glen Maddern](https://github.com/geelen)
54+
- [Tobias Koppers](https://github.com/sokra)
55+
- [Glen Maddern](https://github.com/geelen)
5456

5557
---
58+
5659
Mark Dalgleish, 2015.
5760

58-
[ci-img]: https://img.shields.io/travis/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
59-
[ci]: https://travis-ci.org/css-modules/postcss-modules-local-by-default
60-
[npm-img]: https://img.shields.io/npm/v/postcss-modules-local-by-default.svg?style=flat-square
61-
[npm]: https://www.npmjs.com/package/postcss-modules-local-by-default
61+
[ci-img]: https://img.shields.io/travis/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
62+
[ci]: https://travis-ci.org/css-modules/postcss-modules-local-by-default
63+
[npm-img]: https://img.shields.io/npm/v/postcss-modules-local-by-default.svg?style=flat-square
64+
[npm]: https://www.npmjs.com/package/postcss-modules-local-by-default
6265
[coveralls-img]: https://img.shields.io/coveralls/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
63-
[coveralls]: https://coveralls.io/r/css-modules/postcss-modules-local-by-default?branch=master
64-
[codecov-img]: https://img.shields.io/codecov/c/github/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
65-
[codecov]: https://codecov.io/github/css-modules/postcss-modules-local-by-default?branch=master
66+
[coveralls]: https://coveralls.io/r/css-modules/postcss-modules-local-by-default?branch=master
67+
[codecov-img]: https://img.shields.io/codecov/c/github/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
68+
[codecov]: https://codecov.io/github/css-modules/postcss-modules-local-by-default?branch=master

package.json

+29-28
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,53 @@
11
{
22
"name": "postcss-modules-local-by-default",
3-
"version": "3.0.3",
3+
"version": "4.0.0-rc.0",
44
"description": "A CSS Modules transform to make local scope the default",
5-
"main": "index.js",
5+
"main": "src/index.js",
6+
"author": "Mark Dalgleish",
7+
"license": "MIT",
8+
"files": [
9+
"src"
10+
],
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/css-modules/postcss-modules-local-by-default.git"
14+
},
615
"engines": {
7-
"node": ">= 6"
16+
"node": ">= 10.13.0 || >= 12.13.0 || >= 14"
817
},
918
"keywords": [
1019
"css-modules",
1120
"postcss",
1221
"css",
1322
"postcss-plugin"
1423
],
15-
"author": "Mark Dalgleish",
16-
"license": "MIT",
17-
"repository": {
18-
"type": "git",
19-
"url": "https://github.com/css-modules/postcss-modules-local-by-default.git"
20-
},
21-
"prettier": {
22-
"singleQuote": true,
23-
"trailingComma": "es5"
24+
"scripts": {
25+
"prettier": "prettier -l --ignore-path .gitignore .",
26+
"eslint": "eslint --ignore-path .gitignore .",
27+
"lint": "yarn eslint && yarn prettier",
28+
"pretest": "yarn lint",
29+
"test": "tape test/index.js",
30+
"autotest": "chokidar src/index.js test/test.js -c 'yarn test'",
31+
"cover": "istanbul cover test/index.js",
32+
"ci": "yarn pretest && yarn cover",
33+
"prepublishOnly": "yarn test"
2434
},
2535
"dependencies": {
2636
"icss-utils": "^4.1.1",
27-
"postcss": "^7.0.32",
2837
"postcss-selector-parser": "^6.0.2",
2938
"postcss-value-parser": "^4.1.0"
3039
},
3140
"devDependencies": {
32-
"chokidar-cli": "^1.2.3",
41+
"chokidar-cli": "^2.1.0",
3342
"codecov.io": "^0.1.6",
3443
"coveralls": "^3.1.0",
35-
"eslint": "^5.16.0",
44+
"eslint": "^7.9.0",
3645
"istanbul": "^0.4.5",
46+
"postcss": "^8.0.3",
47+
"prettier": "^2.1.2",
3748
"tape": "^5.0.1"
3849
},
39-
"scripts": {
40-
"lint": "eslint index.js test.js",
41-
"pretest": "yarn lint",
42-
"test": "tape test.js",
43-
"autotest": "chokidar index.js test.js -c 'yarn test'",
44-
"precover": "yarn lint",
45-
"cover": "istanbul cover test.js",
46-
"travis": "yarn lint && yarn cover -- --report lcovonly",
47-
"prepublish": "yarn test"
48-
},
49-
"files": [
50-
"index.js"
51-
]
50+
"peerDependencies": {
51+
"postcss": "^8.0.3"
52+
}
5253
}

0 commit comments

Comments
 (0)