File tree Expand file tree Collapse file tree 12 files changed +106
-24
lines changed Expand file tree Collapse file tree 12 files changed +106
-24
lines changed Original file line number Diff line number Diff line change 1
1
version : 2
2
2
updates :
3
3
- package-ecosystem : " pub"
4
- directory : " /"
4
+ directories :
5
+ - " /"
6
+ - " /analysis"
5
7
schedule :
6
8
interval : " weekly"
7
9
- package-ecosystem : " github-actions"
@@ -13,6 +15,7 @@ updates:
13
15
- package-ecosystem : " npm"
14
16
directories :
15
17
- " /"
18
+ - " /analysis"
16
19
- " /package"
17
20
- " /pkg/sass-parser"
18
21
ignore :
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends": "./node_modules/gts/",
3
+ "plugins": ["import"],
4
+ "rules": {
5
+ "@typescript-eslint/explicit-function-return-type": [
6
+ "error",
7
+ {"allowExpressions": true}
8
+ ],
9
+ "func-style": ["error", "declaration"],
10
+ "prefer-const": ["error", {"destructuring": "all"}],
11
+ // It would be nice to sort import declaration order as well, but that's not
12
+ // autofixable and it's not worth the effort of handling manually.
13
+ "sort-imports": ["error", {"ignoreDeclarationSort": true}],
14
+ },
15
+ "overrides": [
16
+ {
17
+ "files": ["**/*.ts"],
18
+ "rules": {
19
+ "import/no-commonjs": "error"
20
+ }
21
+ }
22
+ ]
23
+ }
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ ...require ( 'gts/.prettierrc.json' ) ,
3
+ } ;
Original file line number Diff line number Diff line change 1
- This package provides a shared set of analysis options for use by Sass team
2
- packages. To use it, add it as a Git dependency to your ` pubspec.yaml ` :
1
+ This package provides a shared static analysis configuration for use by Sass
2
+ team Dart and TypeScript packages.
3
+
4
+ ## Use from Dart
5
+
6
+ Add this as a Git dependency to your ` pubspec.yaml ` :
3
7
4
8
``` yaml
5
9
dev_dependencies :
6
10
sass_analysis :
7
- git : {url:
8
- https://github.com/sass/dart-sass.git, path : analysis}
11
+ git : {url: https://github.com/sass/dart-sass.git, path: analysis}
9
12
` ` `
10
13
11
14
and include it in your ` analysis_options.yaml`:
12
15
13
16
` ` ` yaml
14
17
include: package:sass_analysis/analysis_options.yaml
15
18
` ` `
19
+
20
+ # # Use from TypeScript
21
+
22
+ Add this and [gts] as Git dependencies to your `package.json`, then initialize
23
+ gts :
24
+
25
+ [gts] : https://github.com/google/gts
26
+
27
+ ` ` ` sh
28
+ $ npm i --save-dev gts 'https://gitpkg.vercel.app/sass/dart-sass/analysis?main'
29
+ $ npx gts init
30
+ ` ` `
31
+
32
+ Then edit the configuration files to use Sass-specific customizations instead of
33
+ the gts defaults :
34
+
35
+ * `eslintrc.json`:
36
+
37
+ ` ` ` json
38
+ {
39
+ "extends": "./node_modules/sass-analysis/"
40
+ }
41
+ ` ` `
42
+
43
+ * `.prettierrc.js`:
44
+
45
+ ` ` ` json
46
+ module.exports = {
47
+ ...require(sass-analysis/.prettierrc.js')
48
+ }
49
+ ` ` `
50
+
51
+ * `tsconfig.json`:
52
+
53
+ ` ` ` json
54
+ {
55
+ "extends": "./node_modules/sass-analysis/tsconfig.json",
56
+ "compilerOptions": {
57
+ "rootDir": ".",
58
+ "outDir": "build"
59
+ },
60
+ "include": [
61
+ "src/**/*.ts",
62
+ "test/**/*.ts"
63
+ ]
64
+ }
65
+ ` ` `
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " sass-analysis" ,
3
+ "version" : " 0.0.0" ,
4
+ "description" : " Shared static analysis options for Sass team packages." ,
5
+ "dependencies" : {
6
+ "eslint-plugin-import" : " ^2.30.0" ,
7
+ "gts" : " ^5.0.0" ,
8
+ "jsonc-parser" : " ^3.3.1"
9
+ }
10
+ }
Original file line number Diff line number Diff line change 1
1
name : sass_analysis
2
2
version : 0.0.0
3
3
description : Shared analysis options for Sass team packages.
4
- homepage : https://github.com/sass/dart-sass/tree/master /analysis
4
+ homepage : https://github.com/sass/dart-sass/tree/main /analysis
5
5
6
6
publish_to : none
7
7
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " ./node_modules/gts/tsconfig-google.json"
3
+ }
Original file line number Diff line number Diff line change 1
1
{
2
- "extends": "./node_modules/gts/",
3
- "rules": {
4
- "@typescript-eslint/explicit-function-return-type": [
5
- "error",
6
- {"allowExpressions": true}
7
- ],
8
- "func-style": ["error", "declaration"],
9
- "prefer-const": ["error", {"destructuring": "all"}],
10
- // It would be nice to sort import declaration order as well, but that's not
11
- // autofixable and it's not worth the effort of handling manually.
12
- "sort-imports": ["error", {"ignoreDeclarationSort": true}],
13
- }
2
+ "extends": "./node_modules/sass-analysis/"
14
3
}
Original file line number Diff line number Diff line change 1
1
module . exports = {
2
- ...require ( 'gts /.prettierrc.json ' ) ,
2
+ ...require ( 'sass-analysis /.prettierrc.js ' ) ,
3
3
} ;
Original file line number Diff line number Diff line change 27
27
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
29
29
import * as postcss from 'postcss' ;
30
+ import PostCssStringifier from 'postcss/lib/stringifier' ;
30
31
31
32
import { AnyStatement } from './statement' ;
32
33
import { GenericAtRule } from './statement/generic-at-rule' ;
33
34
import { Rule } from './statement/rule' ;
34
35
35
- const PostCssStringifier = require ( 'postcss/lib/stringifier' ) ;
36
-
37
36
/**
38
37
* A visitor that stringifies Sass statements.
39
38
*
@@ -67,7 +66,7 @@ export class Stringifier extends PostCssStringifier {
67
66
) ( statement , semicolon ) ;
68
67
}
69
68
70
- private atrule ( node : GenericAtRule , semicolon : boolean ) : void {
69
+ atrule ( node : GenericAtRule , semicolon : boolean ) : void {
71
70
const start =
72
71
`@${ node . nameInterpolation } ` +
73
72
( node . raws . afterName ?? ( node . paramsInterpolation ? ' ' : '' ) ) +
@@ -82,7 +81,7 @@ export class Stringifier extends PostCssStringifier {
82
81
}
83
82
}
84
83
85
- private rule ( node : Rule ) : void {
84
+ rule ( node : Rule ) : void {
86
85
this . block ( node , node . selectorInterpolation . toString ( ) ) ;
87
86
}
88
87
}
You can’t perform that action at this time.
0 commit comments